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

Piotr Pasich:
Putting all pieces together and shipping with Codeship (Continuous Deployment – part I
Aug 18, 2015 @ 12:45:01

Piotr Pasich continues his series covering the integration of Docker, Elastic Beanstalk and Codeship to create a workflow for shipping and releasing code. In the first two parts of the series he set up most of the technology involved and hooked some of it together. In this latest article he finishes the process, connecting CodeShip with GitHub and your tests.

Today I will walk you through combining all the pieces together and automating the process fully. A continuous integration system will be placed between developer’s environment and final servers. I’ll present how to achieve all of that with Codeship. What make me choose this particular mechanism? The simplicity of setting up, number of additional tools ready to use without installation and finally the fact that it isn’t time consuming.

He shows how to connect CodeShip with your GitHub repository. He shows how to create a new CodeShip project to handle the build complete with a screencast to ensure things are set up as they should be. He includes a bit of "magic" you'll need to do with the CodeShip configuration to get it to work with the Docker setup, but the change is minimal. He also shows you how to set up the execution of your tests and how to see what failed when a build is broken. Finally he shows the process for setting up the deployment to the hosting provider (in this case Digital Ocean) and how to configure your Amazon credentials right in the interface.

tagged: codeship elasticbeanstalk continuous deployment series part3 docker tutorial

Link: http://piotrpasich.com/putting-all-pieces-together-and-shipping-with-codeship-continuous-deployment-part-iii/

BitExpert Blog:
Think About It: PHP/PostgreSQL Bulk Performance (Part 3)
Jul 24, 2015 @ 10:46:06

On the bitExpert blog they've continued their "Think About It" series of posts looking at optimizations that can be made to different technologies in their stack to increase performance. In this third part of the series they focus in on the changes made to help speed things up with the PostgreSQL database backend.

This article is the last of a three-part series and describes how we optimized the persistence process of bulk data in our code in combination with PostgreSQL. Make sure you covered the first article about how we tweaked PHPExcel to run faster while reading Excel and CSV files and the second article about how we optimized our data processing and reached performance improvements tweaking our code.

They work from the example code provided at the end of part two and update the "update" handling to optimize it a bit. By default it executes an update query for each record so, instead, they modified it to perform a bulk update with an "update from values" format. They could then migrate to a "save all" handler with the complete set of records to save.

tagged: performance postgresql bulk series part3 tutorial phpexcel excel csv

Link: https://blog.bitexpert.de/blog/think-about-it-php-postgresql-bulk-performance-part-3/

Mattias Noback:
Refactoring the Cat API client (3 Part Series)
Jul 16, 2015 @ 11:25:54

Mattias Noback has posted a three part series of tutorial articles around the refactoring of a "CatApi" class. These articles take the class from a jumbled mess of functionality with both direct file access and remote requests mixed in into something much more maintainable and flexible.

t turned out, creating a video tutorial isn't working well for me. I really like writing, and speaking in public, but I'm not very happy about recording videos. I almost never watch videos myself as well, so... the video tutorial I was talking about won't be there. Sorry! To make it up with you, what follows is a series of blog posts, covering the same material as I intended to cover in the first episodes of the tutorial.

In part one he introduces the current state of the "CapApi" class and some of the problems with it, both in testing and in structure. He does some basic refactoring to split out some of the logic here and moves on to part two. In the second part of the series he focuses on refactoring the HTTP request and the local file system functionality into abstract, injectable objects. Finally in part three he adds in some verification around the data being passed back and forth between objects including both simple checking and the use of value objects.

tagged: refactor api class series part1 part2 part3 filesystem http request xml validation

Link: http://php-and-symfony.matthiasnoback.nl/2015/07/refactoring-the-cat-api-client-part-1/

Hafiz Waheeduddin Ahmad:
API Testing: Installing and Using Codeception
Jun 15, 2015 @ 15:45:41

Hafiz Waheeduddin Ahmad has a new post to his site, part three of a series he's posted on API testing, looking at the use of Codeception for testing API output and functionality.

In this post, we will have a look on how we can use Codeception for API testing.

He starts by helping you get Codeception installed through Composer through a "require" command line call. He then walks you through the setup of the project and how to use the "codecept" command line tool. He covers the generated directory structure the bootstrapping created and how to set up a sample configuration for your API. He then gets into writing an example test, showing how to check things like authentication, HTTP header information, response codes and response contents. Finally he shows how to run the tests in both a normal and more verbose way.

tagged: api testing series part3 codeception introduction functional

Link: http://haafiz.me/development/api-testing-installing-and-using-codeception

Damien Seguy:
Prepare for PHP 7 error messages (Series)
May 26, 2015 @ 09:35:11

For those looking forward to PHP 7, there's a new series of posts from Damien Seguy that can help you with some of the newer error messages and what might be causing them.

The first step to prepare for PHP 7 is to lint it : using the command line instruction ‘php -l script.php’, one can easily check that every file in a current application compile with PHP 7. The second step is to run the application and the unit tests : in short, execute it with PHP 7. And this is where we’ll learn about the new errors that PHP has prepared for us. In order to be one step ahead of the migration, this article will help you prepare here is a panorama on PHP error messages.

In part one he looks at some of the most often raised errors including the incorrect use of "$this" and undefined offsets. Part two gets into a few more complex messages about return type hinting, the constant scalar expression and using temporary expressions in a write context. Finally, part three looks at messaging around redefinition of identical parameters, bit shifting by a negative number, named constructor deprecation and strict typing. Each part of the series covers a few more than just the ones listed here too, so be sure to check each for more helpful error messages and solutions.

tagged: php7 error message help series part1 part2 part3 resolve information

Link: http://www.exakat.io/php-7-error-messages-part-1/

Phillip Shipley:
Creating a PHP Nexmo API Client using Guzzle Web Service Client – Part 3
Apr 10, 2015 @ 09:25:40

Phillip Shipley has posted the next part in his series about making a client with Guzzle for the Nexmo API. In this latest post he adds functionality to the client made in previous parts of the series (part1, part two) to allow for message searching.

Now let’s go ahead and add another SMS related API to show how easy it is since we already have the base client and description in place. Nexmo also has APIs to search for a specific message, multiple messages based on some criteria, as well as for rejected messages. Let’s go ahead and add these three interfaces to our SMS description and see what it takes.

He includes the code to add to the current client and configuration to enable the "SearchMessage" functionality and the correct handling of the result. He shows how to update the client class with a new "searchMessage" method and the searching of the rejections with the Insight API.

tagged: nexmo api tutorial client guzzle series part3 webservice search rejected

Link: http://www.phillipshipley.com/2015/04/creating-a-php-nexmo-api-client-using-guzzle-web-service-client-part-3/

A Journey into Microservices
Mar 11, 2015 @ 11:23:34

On the Hailo.com blog Matt Heath has posted a series of articles about their transition from a "monolith" codebase out into a set of microservices for the Hallo app system.

Hailo, like many startups, started small; small enough that our offices were below deck on a boat in central London - the HMS President. Working on a boat as a small focused team, we built out our original apps and APIs using tried and tested technologies, including Java, PHP, MySQL and Redis, all running on Amazon's EC2 platform. [...] After we launched in London, and then Dublin, we expanded from one continent to two, and then three; launching first in North America, and then in Asia. This posed a number of challenges-the main one being locality of customer data.

They describe this customer data problem in a bit more detail with the issue mostly revolving around the geolocation of the user and their information. They talk about "going global" and the steps they took to make the move. In the three parts of the series, they explain the changes they made and why they were effective for their application:

They end the series with some links to other resources that help compliment the subjects mentioned and link to slides from a presentation around the same topic.

tagged: microservice journey series part1 part2 part3 introduction architecture api halloapp

Link: https://sudo.hailoapp.com/services/2015/03/09/journey-into-a-microservice-world-part-1/

Create a Custom Payment Method in OpenCart: Part 3
Jan 21, 2015 @ 10:20:44

NetTuts.com has continued their series showing how to integrate a custom payment method into your OpenCart instance with part three of the series. In this tutorial they focus more on the frontend aspects, creating controller and model handling for the new method.

If you've been following along with this series, you should be familiar with the kind of file structure we set up for our custom payment method in the back-end. [...] We'll use a similar kind of file setup for the front-end section as well.

He starts with the controller, building a handler for the Custom method, doing some data filtering and getting the order information. He walks you through what each of the lines are doing and shows how to output the result back to a view. He also includes the model code needed for the custom payment method as well as language/template files to display the form needed to gather the necessary data.

tagged: opencart part3 series custom payment method tutorial

Link: http://code.tutsplus.com/tutorials/create-a-custom-payment-method-in-opencart-part-3--cms-22464

SitePoint PHP Blog:
Adding Products to Your eBay Store with the Trading API
Jan 13, 2015 @ 12:50:14

The SitePoint blog has posted the next part of their "using the eBay trading API" series today (part three) showing you how to add products to your store via their API.

In this third and final part of our eBay Trading API series, we’ll be building the product adding functionality into our application. Now that we’re done with the store settings, we can begin with writing the code for the controller that would handle the creation of products.

He walks you through the code to create the "new" action on your Slim controller, build the view to gather the product information and handle the upload of product images with the Dropzone Javascript library. Also included is the code to get the current category list (to populate a dropdown list) and the code needed to create the product, both in your database and sending it back to the eBay API for insertion. This finishes the series about using this API, but you can get more information on the API itself though its documentation. The full code for the tutorial series is available on GitHub.

tagged: ebay trading api tutorial series part3 add product upload

Link: http://www.sitepoint.com/adding-products-ebay-store-trading-api/

SitePoint PHP Blog:
Developing PHP Extensions with C++ and PHP-CPP: Advanced
Jan 08, 2015 @ 11:17:47

On the SitePoint PHP blog today Taylor Ren continues his look at using the PHP-CPP library to help build custom extensions. In this latest post he sheds some light on some more advanced topics.

In my earlier articles, I have introduced the PHP-CPP lib to create an extension for PHP using C++ (first article and second article). In the latter, I demonstrated a bit of the OO side of writing a PHP extension with a Complex class doing complex number manipulations. That introduction is not complete as the main focus of that article is more on the demonstration of the OO capability of PHP-CPP, not on the OO implementation details. In this article, we will further drill down the Complex lib development, adding more member functions, and addressing some advanced topics in writing a PHP extension with OO features using PHP-CPP

He breaks up the advanced topics into sections, providing code examples for each:

  • Returning this pointer in C++
  • Returning a Complex object pointer
  • Exposing the __toString magical method
  • Chaining member function calls
  • Exception throwing and handling in PHP

With the code in place, he then shows how to test all of the new functions you've added with a bit of simple PHP code.

tagged: tutorial advanced extension cplusplus phpcpp series part3

Link: http://www.sitepoint.com/developing-php-extensions-c-php-cpp-advanced/