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

Symfony Finland:
What's in store for PHP performance?
Oct 18, 2016 @ 10:20:51

On the Symfony Finland blog there's a new post looking ahead at what they see in store for PHP's performance in a post-PHP 7.0.x world.

PHP 7.0 made significant improvements in terms of performance and memory use for real applications. Many applications deliver twice the throughput with much less memory just without any changes to the application code.

But with networked API driven architectures individual response times are increasingly critical for end-user experience. Luckily, there are quite a few unbeaten paths for regarding PHP performance.

These other "unbeaten paths" they mention include a trend towards using asynchronous patterns and the use of application servers (long running PHP processes). There's also mentions of JIT (just in time) compilation, defined request and response objects and the improvement of other possible PHP runtimes.

tagged: language future performance improvement opinion

Link: https://www.symfony.fi/entry/whats-in-store-for-php-performance

Laravel News:
Improvements to the Laravel unique and exists validation rules
Oct 12, 2016 @ 09:36:42

On the Laravel News site there's a new post sharing some improvements with "unique" and "exists" validation that will be a part of the framework starting in version 5.3.18.

Validating requests in Laravel is simple with its ValidatesRequests trait that is automatically included through the BaseController.

It’s powerful and provides a lot of useful rules for common use cases. Two rules, exists() and unique(), are used to validate against data stored in your database. [...] The style of this is not the easiest to remember and it’s something you almost always have to consult the docs on.

Starting with Laravel v5.3.18 both of these rules have been simplified with an introduction of a new Rule class.

They include some code examples of using this new Rule class and how to use it right along side the current validation rule format for more complex validation needs. There's also a mention of an extra "bonus" that comes with the functionality: a conversion method for translating new rules back into strings.

tagged: laravel improvement unique exists validation rule

Link: https://laravel-news.com/2016/10/unique-and-exists-validation/

Raphael Stolt:
Eight knobs to adjust and improve your Travis CI builds
Oct 11, 2016 @ 09:18:53

If you're a Travis-CI user, like many projects are, you'll find this new post from Raphael Stolt very interesting. In it he provides "eight knobs" you can use to improve your use of the service and optimize your test runs.

After having refactored several Travis CI configuration files over the last weeks, this post will provide eight adjustments or patterns immediately applicable for faster, changeable, and economic builds.

Suggestions in his list include:

  • Reduce git clone depth
  • Configure PHP versions in an include
  • Only do static code analysis or code coverage measurement once
  • Run integration tests on very xth build

For each item on the list he includes the updates you'll need to make to your .travis.yml configuration to enable/disable the feature.

tagged: travisci service performance improvement build top8

Link: http://raphaelstolt.blogspot.com/2016/10/eight-knobs-to-adjust-and-improve-your.html

Ben Ramsey:
Introducing Ramsey/UUID
Apr 25, 2016 @ 10:52:14

In a new post to his site Ben Ramsey finally gets around to posting about a library of his that's not only already widely used but has already been around for a few years - his ramsey/uuid library for generating UUIDs.

It seems quite absurd for me to introduce ramsey/uuid, a library that saw its 1.0.0 release on July 19, 2012, and is now at version 3.4.1, having had 35 releases since its first, but what’s even more ludicrous is that I haven’t once blogged about this library. I mention it only in passing in my “Dates Are Hard” post. So, allow me to introduce you to perhaps a familiar face, an old friend, the ramsey/uuid library for PHP.

He starts with some of the original beginnings of the language back when Composer usage was just first taking off. He'd found other UUID implementations in PHP but none that rivaled the features found in library for other languages. He then briefly explains what a UUID is and what the RFC defines them as. He talks about the name change on the package (from the "Rhumsaa" namespace to "Ramsey") and an issue he received where UUIDs were colliding...as well as how he corrected it. He wraps up the post looking at some of what's coming for the library and what kind of improvements he'll be making in v3.4.1 and beyond.

tagged: ramsey uuid library introduction version opensource project rhumsaa improvement

Link: https://benramsey.com/blog/2016/04/ramsey-uuid/

Freek Van der Herten:
A modern backup solution for Laravel apps
Mar 09, 2016 @ 11:15:54

As Freek Van der Herten mentions in this post to his site the latest release of the Laravel backup package has been released - version 3 - with some major improvements over previous releases.

Today our team released a new major version of laravel-backup. It can backup the files and databases of your application to one or more external filesystems. It uses Laravel’s native cloud filesystem to do this. The package can also notify you via Slack and/or email when something goes wrong with your backups. We’ve also created a dedicated site with full documentation. In this blogpost we want to give you some background of why and how the package was created.

They start out with a bit of history about the package, talking about how they created it to fill their own needs and how its risen in popularity since its release. Following this the post talks about new features in version 3 including:

  • Taking backups
  • Cleaning up old backups
  • Monitoring the health of all backups
  • Sending notifications

There's also some brief mentions of other new features around event hooks and adding additional information to the backup file. There's a bit of code shared to show the quality/readbility of the code and links over to various resources on the documentation site as well. Finally they mention some information about the use of the package in PHP 5 (it has become PHP 7 focused with this release) and some of the alternatives that are out there.

tagged: backup laravel package php7 release improvement features history php5

Link: https://murze.be/2016/03/a-modern-backup-solution-for-laravel-apps/

Rob Allen:
Improved error handling in Slim 3.2.0
Feb 26, 2016 @ 10:46:53

In this recent post to his site Rob Allen, a developer with the Slim framework project, covers some of the improvements around error handling in the latest version of the framework, v3.2.0.

We released Slim 3.2.0 yesterday which includes a number of minor bug fixes since 3.1.0 and also a few nice improvements around the way we handle errors.

He talks about the previous error handling (suppressing them in favor of a bland error page) and how v3.2.0 changes this by writing them to the error log by default. He also talks about changes around the addition of a PHP 7 error handler that works with the PHP 7 Error exception types and functions the same way as the default Exception handler.

tagged: slim slim3 slimeframework error handling improvement errorlog exception php7

Link: https://akrabat.com/improved-error-handling-in-slim-3-2-0/

Symfony Blog:
Improving the Symfony Release Process
Dec 11, 2015 @ 10:49:10

On the Symfony blog there's a new post from Javier Eguiluz talking about improvements to the Symfony release process that will be starting with the 3.0.0 stable release (already release so already in place).

The Symfony Release Process is arguably one of the best selling points of the Symfony project. Thanks to our predictable and transparent process, companies can plan years in ahead their Symfony integration.

The recent launch of Symfony 2.8, which will be the last minor version of the 2.x branch, made us think about further tweaks in the release process. That's why during his past SymfonyCon Paris 2015 keynote, Fabien Potencier announced the new Symfony release process.

The main changes for the process are around how many minor versions will be published, standard vs long term support status of these releases and the timing of major/minor releases. With this schedule in place, it's projected that Symfony 4 will be released in November of 2017.

tagged: symfony release process improvement schedule minor major version

Link: http://symfony.com/blog/improving-the-symfony-release-process

Lakion Blog:
How we sped up Sylius' Behat suite with Blackfire
Dec 01, 2015 @ 12:08:57

On the Lakion blog there's a recent post sharing how they used the Blackfire.io profiling service to [speed up their application's tests] (Behat)(http://lakion.com/blog/how-did-we-speed-up-sylius-behat-suite-with-blackfire) and find the "pain points" to fix.

Feedback time is one of the most crucial factors during development and the red - green - refactor cycle. In case of Sylius, the full build used to take two and a half hour, including 55 minutes for only PHP 5.6 jobs. Waiting so long for feedback is not an option for a project of this size and with so many active contributors. As much as I am Xdebug fan, I have never really used it for profiling - the snapshots generation was slowing down the profiled script significantly and resulted in monstrous files, which weren't easy to read.

Half a year after I have first heard of blackfire.io I decided to give it a try. It resulted in a series of pull requests that speeds up Sylius test suites 6 times and reduces memory usage to one tenth.

They go through some of the major bottlenecks that the service helped them locate including:

  • an issue with the login process and their role evaluation handling
  • problems with time spent doing router initialization
  • Doctrine performance issues running it without a class metadata cache

For each item they describe what the service was reporting and how they corrected it in the application. Most of the changes were relatively small, fortunately. They also link to the results from before and after the changes so you can see the difference. As their environment is Symfony-based they end the post with some other helpful Symfony tips to getting the most out of your application and enhancing its performance in a few simple ways.

tagged: blackfireio behat test suite performance improvement profiling

Link: http://lakion.com/blog/how-did-we-speed-up-sylius-behat-suite-with-blackfire

HHVM Blog:
Improving Arrays in Hack
Nov 03, 2015 @ 11:46:14

On the HHVM blog there's a post talking about some of the updates they've made with array handling in Hack to help make it more efficient and overcoming some of the challenges in how they're being used.

Arrays are the ubiquitous data structure in PHP, used to represent everything from lists, associated lists, sets, tuples, or even a bag of data. This flexibility itself makes it challenging for Hack to understand how an array will be used. [...] If this was the only problem with PHP arrays, then the solution would be “simple”; make the type checker smarter (something we are working on). However there are a number of other semantic details around arrays that are nearly impossible to analyze statically.

They talk about some of the issues a bit more specifically including:

  • indexing of non-existent keys
  • key coercion
  • arrays containing references

They also talk about some of the legitimate use cases for arrays over the collections Hack offers, mostly do to with the values they could contain. The post ends with links to some of the other future improvements to the array handling in Hack and a look further out and their vision of replacing PHP arrays with Hack arrays and moving collections to a runtime library.

tagged: hhvm hack array improvement problem values collections

Link: http://hhvm.com/blog/10649/improving-arrays-in-hack

Julien Pauli:
Huge Page usage in PHP 7
Oct 30, 2015 @ 12:16:48

In this post to his site Julien Pauli looks at the concept of "huge pages" and how it relates to some of the behind the scenes work done in PHP 7 to improve memory usage.

Memory paging is a way Operating Systems manage userland process memory. Each process memory access is virtual, and the OS together with the hardware MMU must translate that address into a physical address used to access the data in main memory (RAM).

Paging memory is dividing memory in chunks of fixed size, called pages. [...] Why use huge pages? The concept is easy. If we make the OS Kernel use bigger page sizes, that means that more data can be accessed into one single page. That also means that we'll suffer from less TLB miss, once the page translation is stored into the TLB, because one translation will now be valid for more data.

He briefly covers how some updated memory handling and opcode restructuring helps PHP 7 perform even better, especially when it comes to the OPCache handling. He talks about the changes made in the extension specifically to support the "huge pages" idea, complete with code examples (in C) of how this was accomplished.

tagged: huge page php7 memory improvement performance opcache

Link: http://jpauli.github.io/2015/10/28/huge-page.html