News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Drupal 8 Hooks and the Symfony Event Dispatcher
October 21, 2014 @ 13:14:53

The SitePoint PHP blog has a new tutorial posted today showing the interaction between Drupal 8 hooks and the Symfony dispatcher in the last part of their series showing how to build a custom Drupal 8 module.

With the incorporation of many Symfony components into Drupal in its 8th version, we are seeing a shift away from many Drupalisms towards more modern PHP architectural decisions. For example, the both loved and hated hook system is getting slowly replaced. Plugins and annotations are taking away much of the need for info hooks and the Symfony Event Dispatcher component is replacing some of the invoked hooks. Although they remain strong in Drupal 8, it's very possible that with Drupal 9 (or maybe 10) hooks will be completely removed.

He starts off with a brief introduction to what the event dispatcher is and how it currently interacts with the Drupal 8 system. He uses a simple form example with two text fields and how to hook in the dispatcher to fire a "demo_form.save" event when the user submits the form. He ties this into a DemoEvent and sets up a simple subscriber. He ends the article with a look at using hooks to achieve the same kind of goal.

0 comments voice your opinion now!
drupal8 tutorial hooks event dispatcher symfony component

Link: http://www.sitepoint.com/drupal-8-hooks-symfony-event-dispatcher/

NetTuts.com:
Building Advanced Email Features With IMAP and PHP
October 21, 2014 @ 12:19:47

On the NetTuts.com site they've posted a tutorial showing you how to build advanced features with IMAP and PHP. He bases it on the SimplifyEmail project and incldues examples of three different features to get you started.

Analysis of my own email showed I was receiving email from more than 230 automated senders, far fewer actual people. I was tired of constructing filters in Gmail and filling in a myriad of unsubscribe forms. I wanted to have more control over managing my email and simplifying my life. Finally, this past year, I decided to build the features I needed. The result is Simplify Email (SE), a small web app you can host yourself which offers a variety of cool new email features all of which you can check out on the project website. The coolest thing about SE is that it's a platform for reading, analyzing, routing and managing your email - the possibilities abound. Simplify Email is essentially a programmable playground for "hacking" your own email.

His three examples show you how to:

  • Checking your inbox and filter messages
  • Implement a Whitelist challenge to unknown senders
  • Reporting unanswered email

Each of these comes with plenty of code examples, screenshots and output examples (as well as some places where you might need to change some SE configuration values).

0 comments voice your opinion now!
advanced email imap tutorial feature simpleemail filter whitelist reporting

Link: http://code.tutsplus.com/tutorials/building-advanced-email-features-with-imap-and-php--cms-22059

SitePoint PHP Blog:
PHP and RabbitMQ Advanced Examples
October 20, 2014 @ 14:19:33

On the SitePoint PHP blog Miguel Ibarra Romero continues his series looking at the use of RabbitMQ with PHP in part two. He builds on the code (and setup) from the first part of the series and gets into some more advanced examples this time.

In part 1 we covered the theory and a simple use case of the AMQP protocol in PHP with RabbitMQ as the broker. Now, let's dive into some more advanced examples.

The remainder of the post includes two examples of more advanced operations:

  • Example 1: send request to process data asynchronously among several workers
  • Example 2: send RPC requests and expect a reply

Each example includes a diagram of the overall flow of the process, the code to make it happen both for the sender and receiver.

0 comments voice your opinion now!
rabbitmq advanced example tutorial series part2

Link: http://www.sitepoint.com/php-rabbitmq-advanced-examples/

NetTuts.com:
Design Patterns The Facade Pattern
October 20, 2014 @ 13:17:46

NetTuts.com has continued their series covering common design patterns and their implementation in some example PHP scripts today. In their latest post they focus on the Facade pattern, a member of the "structural" family of patterns.

When it comes to design patterns, you may have questions: Why should we use design patterns in programming? Our code can work just fine without it. [...] Code that employs design patterns is easy to understand, easy to maintain, and easy to extend.[...] In this tutorial, we are going to cover the facade design pattern. It falls under the category of structural patterns because it deals with how your code should be structured to make it easily intelligible and keep it well maintained in the long term.

They start with a UML layout of a typical Facade and include a typical problem/solution where it could be used. They get into a code example that creates a simple checkout process. In this process, they use the Facade pattern to create a more maintainable, extensible ordering workflow.

0 comments voice your opinion now!
designpattern facade introduction tutorial uml series

Link: http://code.tutsplus.com/tutorials/design-patterns-the-facade-pattern--cms-22238

Qandidate.com Blog:
Using the Accept Header to version your API
October 20, 2014 @ 12:56:46

On the Qandidate.com blog today there's a new tutorial talking about the use of the Accept header in REST HTTP requests and, more specifically, working with it in a Symfony-based application.

I investigated different ways to version a REST API. Most of the sources I found, pretty much all said the same thing. To version any resource on the internet, you should not change the URL. The web isn't versioned, and changing the URL would tell a client there is more than 1 resource. [...] Another thing, and probably even more important, you should always try to make sure your changes are backwards compatible. That would mean there is a lot of thinking involved before the actual API is built, but it can also save you from a big, very big headache. [...] Of course there are always occasions where BC breaks are essential in order to move forward. In this case versioning becomes important. The method that I found, which appears to be the most logical, is by requesting a specific API version using the Accept header.

He shows how to create a "match request" method in his custom Router that makes use of the AcceptHeader handling to grab the header data and parse it down into the type and API version requested. He also includes an example of doing something similar in the Symfony configuration file but hard-coding the condition for the API version by endpoint.

0 comments voice your opinion now!
accept header rest api versioning symfony tutorial

Link: http://labs.qandidate.com/blog/2014/10/16/using-the-accept-header-to-version-your-api/

SitePoint PHP Blog:
How to use RabbitMQ with PHP
October 17, 2014 @ 12:43:04

The SitePoint PHP blog has published a new tutorial today by Miguel Ibarra Romero introducing you to the RabbitMQ queuing tool and shows you how to use it in PHP-based applications via the php-amqplib library.

AMQP (Advanced Message Queueing Protocol) is a network protocol that can deliver messages from one application endpoint to another application endpoint. It does not care about the platform or language of said applications, as long as they support AMQP. [...] The advantage of having a message broker such as RabbitMQ, and AMQP being a network protocol, is that the producer, the broker, and the consumer can live on different physical/virtual servers on different geographic locations.

With some of the introductions out of the way (common terms, flow of the data, etc) he walks through the installation of the RabbitMQ software on your system. He uses a Ubuntu install, but the commands could be easily ported for other distributions. From there he shows how to install the PHP library and a simple example of a pizza ordering system where orders are sent to be processed offline. Complete code is included to make the "SimpleSender" class and push the request out to the queue. With that working, he also shows how to create a SimpleReceiver class that consumes the data from the queue and sends the data to be processed.

0 comments voice your opinion now!
rabbitmq tutorial introduction installation library phpamqplib

Link: http://www.sitepoint.com/use-rabbitmq-php/

Matt Stauffer:
Laravel 5.0 - Middleware (replacing Filters)
October 15, 2014 @ 10:18:00

In a new post to his site Matt Stauffer looks at a feature of the upcoming version 5 of the Laravel framework, middleware, and how it will replace the current Filter handling. This is part nine in a series about the new features coming in Laravel (the rest are linked at the top of the article).

If you've been following along with my previous blog posts about Laravel 5.0, you may have noticed that route filters were first moved to be their own directory and class structure, and then eventually they mysteriously disappeared. You may have even noticed that references to Middleware showed up in their place.

He starts off by defining what "middleware" actually is and how it fits into the overall execution flow of the application. He describes it as "a series of wrappers around your application that decorate the requests and the responses in a way that isn't a part of your application logic." He then gets into the code examples, showing how to write a simple Laravel-friendly middleware that blocks odd port requests to the application. He includes the configuration updates to integrate it, how to control where it runs and using before and after "filters" inside the middleware.

0 comments voice your opinion now!
series part9 tutorial laravel framework filter middleware introduction

Link: http://mattstauffer.co/blog/laravel-5.0-middleware-replacing-filters

Rafael Dohms:
Installing Composer Packages
October 14, 2014 @ 12:04:58

Maybe you've heard about Composer and how it makes working with PHP libraries and packages easier. There's lots of articles (besides the project documentation) that can help you get started but Rafael Dohms has just shared an excellent overview of versioning and the features the tool makes available to fine tune your requirements to just the right level.

I have been putting together a new talk about Composer, and that means looking around the community, doing loads of research and trying to identify the items that need to be covered in a talk. Mostly I have been trying to identify things that people do on a regular basis that according to composer internals is either wrong or not ideal. One such thing that I have found is the proper selection of versions, and that also led me to find a new feature in composer that makes everyone's life so much easier. So let me break this down.

He starts with a look at the selection of the actual version you'll need and how Composer treats each type of version match (strict vs wildcards vs a mix of the two). He shows an example of adding one of these version strings to a "composer,json" file, both manually and via a command line call.

0 comments voice your opinion now!
composer version package require install tutorial

Link: http://blog.doh.ms/2014/10/13/installing-composer-packages/

SitePoint PHP Blog:
Bitcoin and PHP with Coinbase's API - Demo App
October 09, 2014 @ 09:25:51

The SitePoint PHP blog has posted the second part of their series about using the CoinBase API through PHP. In this new tutorial they use the API connection made in the first part via the Coinbase SDK.

In part 1, we covered basic installation and usage of Coinbase's Bitcoin PHP API and the accompanying SDK. In this second and final part, we'll be building our sample application.

He briefly shows how to send and receive bitcoins before diving into the application. His simple application includes a basic welcome page, a payment page, thanks page and a cancel page (in case of errors). Complete code for the HTML, CSS, and PHP (API calls) is included in the post. He shows how to create the button to start the payment process and add it to the page.

0 comments voice your opinion now!
coinbase bitcoin series tutorial part2 demo application

Link: http://www.sitepoint.com/bitcoin-php-coinbases-api-demo-app/

Twilio Blog:
How to Build a Digital Decoder Ring Using PHP, FilePreviews.io and Twilio MMS
October 08, 2014 @ 13:25:30

The Twilio blog has an interesting post that lets you "tap into your inner spy" and shows you how to use their service to build a "digital decoder ring" that decodes text based on a Caesar cipher and revert it back from its encoded state, texting the results back to the user.

If you are like me you've probably always wanted to tap into your inner Sydney Bristow [from Alias] and become a kick-ass CIA spy. Today I'm going to show you how to use PHP, FilePreviews.io and Twilio MMS to come one step closer to that dream. We're going to build an app that lets you snap a picture of a Caesar ciphered text, send it to a phone number and get a response with the decoded text. I

He starts with a list of things you'll need (including accounts on Twilio and FilePreviews.io) and the Twilio PHP SDK. The remainder of the post walks you through the code and pieces you'll need to make it all work:

  • Analyzing Our Image
  • Receiving Images Via MMS
  • Cracking the Code

The end result will send the decoded information back to the caller using the rickyrobinett/CaesarCipher library sent through the Twilio service. You can get the full, working code for the example on Ricky Robinett's GitHub account.

0 comments voice your opinion now!
twilio decoderring filepreviewio caesar cypher tutorial mms

Link: https://www.twilio.com/blog/2014/10/how-to-build-a-digital-decoder-ring-using-php-filepreviews-io-and-twilio-mms.html


Community Events





Don't see your event here?
Let us know!


introduction api library community update laravel opinion language symfony deployment tips release podcast series interview package framework zendserver install list

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework