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

QaFoo Blog:
Common Bottlenecks in Performance Tests
Apr 22, 2016 @ 11:24:46

On the QaFoo blog there's a post sharing some of what they've learned about the common bottlenecks in performance testing and some things you can to do determine the issues in your own tests.

Most developers by now internalized that we should not invest time in optimizations before we know what happens exactly. [...] This is true for optimizations in your PHP code but also for optimizations regarding your infrastructure. We should measure before we try to optimize and waste time. When it comes to the assumed performance problems in your system architecture most people guess the root cause will be the database. This might be true but in most projects we put under load it proved to be false.

So, how can we figure out where the problems are located in our stack?

They talk about some common testing practices using basic tools (like ab and siege) and having them perform common operations on the application. They then talk about testing for high load, monitoring the stack for the impact and a few tools you can use to gather statistics. They end the post with a quick mention that, despite popular opinion, the issue isn't always the database's fault. Sometimes other technology that's in play - like file locking issues or processing for server-side includes - and other things that may only show up under high load.

tagged: common bottleneck performance test advice server monitor tool

Link: https://qafoo.com/blog/082_common_bottlenecks_in_performance_tests.html

SitePoint PHP Blog:
Easy Deployment of PHP Applications with Deployer
Apr 08, 2016 @ 09:42:51

The SitePoint PHP blog has a tutorial showing you how to deploy your applications with Deployer, a simple deployment tool that aims to make it as easy as a single command to release you application to production.

Everybody tries to automate their development process, testing, code formatting, system checks, etc. This is also the case for deploying our applications or pushing a new version to the production server. Some of us do this manually by uploading the code using an FTP client, others prefer Phing, and Laravel users will prefer Envoyer for this process. In this article, I’m going to introduce you to Deployer – a deployment tool for PHP.

To introduce you to the tool they walk you through the deployment of a demo application, a simple tool that was used in a previous tutorial to connect to the 500px API. They help you get it installed and start in on some of the basic configuration:

  • setting up the target servers and environments
  • using SSH authentication
  • defining basic tasks
  • making use of "zero downtime" releases
  • using some common built-in tasks

Finally, they link to a recipes section on the Deployer website that gives you more advanced and wider reaching examples.

tagged: deployment deployer tutorial tool example introduction configuration

Link: http://www.sitepoint.com/deploying-php-applications-with-deployer/

Freek Van der Herten:
Converting PHP 7 code to equivalent PHP 5 code
Apr 01, 2016 @ 09:50:56

Freek Van der Herten has a post to his site about another new library he's worked on (along with two others) to help convert PHP 7 code back to PHP 5 code - 7to5.

In the JavaScript world converting modern code to an older syntax is quite common. In the PHP world you don’t see that happen often. Symfony provides a few [polyfills](https://github.com/symfony/polyfill), but a full fledged conversion isn’t available. At the meetup of [our local PHP user group](http://www.meetup.com/phpantwerp/) [Jens Segers](https://twitter.com/jenssegers), [Hannes Van de Vreken](https://twitter.com/hannesvdvreken) and I were toying around with the idea of converting PHP 7 code to equivalent PHP 5 code automatically.

Today our little hobby project called 7to5 was tagged 1.0.0. You can view the repo on GitHub.

He starts by talking about what the library does to backport the code from PHP 7 to PHP 5 and how to install/use the command line tool. He then gets into things "behind the curtains" with a sample PHP 7 class and the resulting PHP 5 code. They made use of the PHP Parser tool for processing the PHP code provided. It does matching on certain element types and performs the token replacement. He gives examples of this with the null coalesce operator replacement and scalar type hinting.

tagged: convert php7 php5 code tool 7to5 introduction library

Link: https://murze.be/2016/03/converting-php-7-code-equivalent-php-5-code/

SitePoint PHP Blog:
Sourcehunt March 2016: PHP in Rust, Pathfinding, Eve Online
Mar 22, 2016 @ 12:12:13

The SitePoint PHP blog has posted their latest edition of their "Sourcehunt" series, highlighting interesting and useful projects around the PHP community. In this latest edition they mention a wide range of projects including:

There's one other library mentioned in the list for the Eve Online players out there showing details for its public market API. Each item on the list includes a brief description and the number of stars the repository currently has.

tagged: sourcehunt series march2016 library tool spotlight

Link: http://www.sitepoint.com/sourcehunt-2016-03-php-in-rust-pathfinding-eve-online/

That Podcast:
Episode 26: Show me the Monii
Mar 09, 2016 @ 09:13:26

That Podcast, a show hosted by PHP community members Beau Simensen and Dave Marshall, has posted their latest episode - Episode #26: Show me the Monii.

Beau and Dave start a series of episodes discussing Beau's new startup, Monii. We talk briefly about the features and scope of their first product, including how he can really see how it would have helped him while he was self-employed.

We then take a dive in to some of the tech stack, with Beau telling us all about the front-end, including the frameworks, libraries and build tools.

Other topics mentioned in this episode include React, the JSON API project, Babel and Webpack. You can listen to this latest episode either through the in-page audio player or by downloading the mp3 directly. If you enjoy the show, be sure to subscribe to their RSS feed or on iTunes to get the latest episodes as they're released.

tagged: thatpodcast ep26 monii frontend framework library build tool

Link: https://thatpodcast.io/episodes/episode-26-show-me-the-monii

Andreas Gohr:
Visualizing XDebug Traces
Feb 29, 2016 @ 12:49:44

Andreas Gohr has posted an interesting article to his site showing you how you can easily visualize XDebug stack traces and make them a bit more clear than the usual output dump.

As alluded to in yesterday's post, I'm currently hunting an elusive bug with xdebug. The problem is, that it only happens sporadically and when I know it happened it is too late to set a break point. So usual debugging methods don't work. Instead I want to use xdebug's execution tracing: let it log all function calls and then pick through the log when the bug occurs.

[...] To ease my debugging I looked for tools that could read the computer readable format. I found a few promising candidates, but in the end they either didn't work or they did not provide what I needed. So instead of hunting the bug, I built a tool

His tool takes in the XDebug output and turns it into something much more readable and properly nested.

tagged: tool library nested output trace stack debugging xdebug

Link: http://www.splitbrain.org/blog/2016-02/27-visualizing_xdebug_traces

Zend Developer Zone:
Introspecting your Code with Z-Ray for Azure
Jan 13, 2016 @ 12:38:38

On the Zend Developer Zone blog Daniel Berman has posted a guide showing how to use their Z-Ray plugin to inspect code running on Azure for statistics around performance, queries and errors thrown by the code.

Quick experimentation, easy collaboration, automated infrastructure and scalability, together with advanced diagnostic and analytical tools – all provide PHP developers with good reasons to develop in the cloud.

[...] The combination of Z-Ray and the Azure cloud means PHP developers building apps on the Azure web app service get the best of both worlds – Z-Ray’s powerful introspection capabilities and Azure’s rich cloud infrastructure.

The post walks you through the steps to create a new Azure-based web application, how to upload your code and enable the Z-Ray feature directly from the Azure "Tools" menu. The Z-Ray toolbar is then automatically injected into your application for your immediate profiling needs.

tagged: azure microsoft hosting zray profiling tool interface tutorial

Link: http://devzone.zend.com/7093/introspecting-code-with-z-ray-for-azure/

Lakion Blog:
TDD your API with Symfony and PHPUnit
Dec 31, 2015 @ 09:16:52

On the Lakion blog there's a post showing you how to use a simple test class/tool they've created to unit test your APIs with PHPUnit.

At Lakion we truly believe in TDD approach. We are convinced that rapid development can not be achieved without proper testing and SOLID code. We always start with defining our needs and writing scenarios, specifications or tests that reflect them. Thanks to this approach, we get exactly what we need and tests are protecting us from regressions. [...] We have come up with a very simple but useful PHPUnit test case for testing APIs. - ApiTestCase.

They start with a bit about the ApiTestCase library and some background on why they created it and some of the features it provides (and other libraries it includes). They then show an example of a simple project using the testing tool to make a request to an endpoint (POST) and check the response matches what's expected. According to the TDD approach, the test fails first then they go back and create the functionality behind to to make it all work.

tagged: tdd phpunit api testing unittest integration apitestcase library tool

Link: http://lakion.com/blog/tdd-your-api-with-symfony-and-phpunit

Rob Allen:
Running Phan against Slim 3
Dec 10, 2015 @ 09:51:20

Rob Allen has a quick post sharing the results of a test run of the Phan static analysis tool on the current state of the Slim 3 framework codebase (with v3.0 just being released).

Having installed Phan, I decided to use it against the upcoming Slim 3 codebase.

Phan needs a list of files to scan, and the place I started was with Lorna's article on Generating a file list for Phan.

He walks through the steps for creating this list of files (removing developer dependencies) and the results from the Phan execution. While a good amount of the errors related more to dependencies and missing class/interface definitions, there were some typing errors found based on the difference between the docblock and how the code handled the variable.

tagged: phan static analysis tool slim3 framework results

Link: https://akrabat.com/running-phan-against-slim-3

Rob Allen:
Installing Phan on OS X
Dec 03, 2015 @ 09:27:37

Rob Allen has posted a quick tip to his site showing how to get Phan installed on an OS X system. Phan is a static analysis tool written for PHP 7 and makes use of the new functionality that exposes the AST for the underlying language.

I use Homebrew for my local PHP installation on OS X and am currently running PHP 7.0.0 RC8.

Phan is a static analyser for PHP 7 which was written by Rasmus and then rewritten by Andrew Morrison. As it benefits from PHP 7's abstract syntax tree it can find all kinds of subtle errors, so I wanted to install it locally to have a play with it.

He shows how to get the tool installed via Composer (with a custom repository definition) and links to the ast extension you'll need installed to let the tool work. A quick exit to your php.ini file is then all it takes to complete the installation and let you install and run the tool from the command line.

tagged: phan static analysis tool php7 install configure osx

Link: http://akrabat.com/installing-phan-on-os-x/