News Feed
Sections




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

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

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

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 fil e 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

SitePoint PHP Blog:
Bitcoin and PHP with Coinbase's API - Basic Usage
October 07, 2014 @ 10:41:31

On the SitePoint PHP blog there's a recent post showing you how to combine PHP and the Coinbase API to add the ability to accept bitcoins as payment in your application. This is part one in a series of posts about making the connection and integrating it into the application.

Have you ever thought about selling your services in exchange for Bitcoins? It's not so strange - today, many big players are actually doing it. From OkCupid to KhanAcademy, even WordPress is accepting Bitcoin. Also, some countries are thinking about it as a currency. Today, we will see how to accept Bitcoin payments on your website/application in an easy way, with the Coinbase API (and its SDK).

He briefly explains what kind of services the Coinbase API provides and talks about some of the different integration methods they offer. While they do offer a "button" you can add to the site, this tutorial focuses on the PHP integration using their SDK. They help you get it installed and show how to use the Coinbase site to set up authentication and authorization handling. He helps you get an instance of the Coinbase object ready for use and shows how to use it to interact with your account. The SDK also allows you to create the same button as the Coinbase site does, just in a more programatic way.

0 comments voice your opinion now!
bitcoin api tutorial coinbase part1 series sdk interact

Link: http://www.sitepoint.com/bitcoin-php-coinbases-api-basic-usage/

SitePoint PHP Blog:
How to Use PHPbrew and VirtPHP
October 06, 2014 @ 13:08:41

Phil Sturgeon has written up a new tutorial for the SitePoint PHP blog showing you how to use PHPbrew and VirtPHP to be able to work with more than one PHP version on the same system.

We've all been in the situation where we have one version installed. Maybe that version is whatever came installed on our operating system. Maybe it is a version bundled into MAMP/WAMP/XAMPP. How do you go about switching that PHP version? How do you switch to one version, then switch back again? How do you go about switching that version of PHP, but only for one single application on your computer? The Ruby and Python communities have had tools for dealing with this for years. PHP has them now too, but there was nowhere near enough fanfare.

He starts with PHPbrew and walks you through a basic install and configuration of a version of PHP 5.6.0. He shows how to add extension support and switch between the different PHP versions at will. Next comes the look at VirtPHP, a similar system that takes a little bit different approach. It creates "environments" that contain the PHP version to a bit more isolated setup. With an environment created, VirtPHP lets you install PECL extensions without changing anything globally. He ends the post with a comparison to how most developers (developing locally) handle their setup and mentions Vagrant, but notes that it may be a bit much for the solo developer.

0 comments voice your opinion now!
virtphp phpbrew tutorial multiple version install configure

Link: http://www.sitepoint.com/use-phpbrew-virtphp/


Community Events





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


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

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