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

Derick Rethans:
Analemmas
Mar 06, 2018 @ 16:28:20

In a new post to his site Derick Rethans talks about "analemmas" and shows how to use PHP's own DateTime handling to determine the locations of the sun at different intervals (that's what an "analemma" tracks).

Last week I listened to an The Sceptics' Guide to the Universe where the word of the week was "But as I am currently starting to update the Guide to Date and Time Programming for a second edition, I was wondering whether I could create an analemma from existing PHP functions. Unfortunately, PHP only provides functionality to calculate when the Sun is at its highest point, through date_sun_info().

He includes an example of this function in use to determine the time the sun was at its zenith. While PHP by itself can't calculate the position, Derick remembered a PHP extension he wrote that could help: php-solarsystem. He includes some code using this functionality to iterate and locate the sun via its azimuth and altitude based on his choice of location (London). The result is a CSV export of data that he then drops in to gnuplot to create the graph of the analemma during that time.

tagged: analemma sun location diagram extension tutorial datetime graph calculate

Link: https://derickrethans.nl/analemma.html

Forma-Pro.com Blog:
PHP AMQP clients. Benchmark them all!
Dec 21, 2017 @ 17:23:31

On the Forma-Pro.com blog there's a new post from Maskim (their Chief Architect) comparing PHP AMPQ libraries including some benchmarks of their performance of their handling of messages.

Increasing popularity of AMQP interop prompted a wave of questions regarding which adapter is the fastest. In this post, I am going to share my findings of message publishing performance. There will be a similar post about consumption side.

He compares three of the main libraries: php-amqplib, amqp-ext and bunny (as well as their adapters for interoperability). To get a good comparison he's also thrown in one written in Golang for external comparison. He start be outlining the system specs he used for testing and then various graphs of the benchmark results. The results of his benchmark script are interesting with only a few oddities here and there. The post finishes with a summation of the results but you'll have to head over there to see those results.

tagged: ampq clients benchmark messagespersecond graph script results

Link: https://blog.forma-pro.com/php-amqp-clients-benchmark-them-all-8a4e6adb1a6b

Symfony Finland:
PHP 7.1 vs 7.2 Benchmarks (with Docker and Symfony Flex)
Oct 17, 2017 @ 16:17:25

On the Symfony Finland site there's a new post sharing the results of some recent benchmarks of the differences between running the framework on PHP 7.1 and PHP 7.2:

PHP 7.2 will be launching soon, in fact, it has already reached Release Candidate status. I was exploring Symfony Flex with Docker setup and thought I would do a quick round of tests to compare the differences in PHP 7.1 and 7.2 (RC4) regarding performance with a few benchmarks.

[...] The benchmarked application is the Symfony Flex port of the hybrid application I did back in January. The project now has the required configuration to run it with Docker, and you can find the full source on GitHub.

The post then shares some of the results and conclusions of the test runs, showing the differences between the two versions. In one set of tests, they're calling the front page controller with Twig rendering and in the other a backend controller without the display rendering. PHP 7.2 ends up performing slightly better than PHP 7.1 overall but not by very much in most cases. The more dramatic change is on the backend, though, with a good jump in performance for a Symfony Flex application.

tagged: symfony flex application benchmark php71 php72 compare results graph

Link: https://symfony.fi/entry/php-7-1-vs-7-2-benchmarks-with-docker-and-symfony-flex

Jordi Boggiano:
PHP Versions Stats - 2017.1 Edition
May 09, 2017 @ 14:16:21

Jordi Boggiano, author and lead developer on the Composer project has posted his latest updates sharing the PHP version statistics for the first part of 2017.

It's stats o'clock! See 2014, 2015, 2016.1 and 2016.2 for previous similar posts.

A quick note on methodology, because all these stats are imperfect as they just sample some subset of the PHP user base. I look in the packagist.org logs of the last month for Composer installs done by someone. Composer sends the PHP version it is running with in its User-Agent header, so I can use that to see which PHP versions people are using Composer with.

He starts with the differences between now and the last time he ran the stats with a nice trends towards the PHP 7.x releases, especially PHP 7.1. He shares some graphs of the overall version distribution and a time-related graph showing changes in usage over time. Finally, he ends the post the same way as the others showing requirements of packages and how they've changed since the last update (what version a package requires).

tagged: version statistics results graph time php7 2017

Link: https://seld.be/notes/php-versions-stats-2017-1-edition

Leonid Mamchenkov:
Dependency resolution with graphs in PHP
Nov 22, 2016 @ 16:52:23

Leonid Mamchenkov has a post to his site showing how he solved an interesting problem in one of his recent projects: determining the order to use items based on their dependencies.

One of the projects I am working on at work presented an interesting problem. I had a list of items with dependencies on one another and I needed to figure out the order in which to use those items, based on their dependencies.

He gives the example of database tables where it would be required to export the tables so that the relations between them are maintained when imported back in. He gives some example data, a basic nested PHP array, and defines the relationships between them (just strings in this case). While he did solve the problem, he wasn't happy with the solution. Instead he went looking for other options and found graph theory to be a good match. He briefly cover what the theory involves and links to an example that basically does what he needs...but is written in Python. He finishes off the post sharing his refactoring of this logic into PHP including a recursive "dependency resolver" and the output showing the correct ordering for loading objects based on their dependencies.

tagged: resolve dependency graph theory example tutorial load order

Link: http://mamchenkov.net/wordpress/2016/11/22/dependency-resolution-with-graphs-in-php/

Carlos Buenosvinos:
First tests with #PHP7 in production at @AtrapaloEng
Mar 18, 2016 @ 16:15:45

On his site Carlos Buenosvinos has a new post talking about the experience they had at @AtrapaloEng with PHP 7 and shares some of the improvements they've already seen so far.

On Monday, Badoo blogged about its migration to PHP7 (https://techblog.badoo.com/blog/2016/03/14/how-badoo-saved-one-million-dollars-switching-to-php7/). Those are great results! At @AtrapaloEng, we’re running already tests in production to perform the same step. We could have started some months before, but we’ve been struggling with the php-msgpack extension and its (un)support for PHP7. We hope to deploy PHP7 in all our server during this week but we would like to share with you what we have seen so far.

They share some graphs showing the changes when PHP 7 was deployed on their systems for both memory consumption and overall load average. They also talk about the boost in performance as far as response times and, an often not reported statistic, how it sped up their unit test runs too.

tagged: test php7 atrapaloeng performance results graph unittest

Link: https://carlosbuenosvinos.com/first-tests-with-php7-in-production-at-atrapaloeng/

Symfony Finland:
Symfony Benchmarks: PHP 5.6, HHVM 3.11 and PHP 7.0.1
Dec 29, 2015 @ 16:53:46

The Symfony Finland has shared some benchmarks of the latest versions of the Symfony framework (simple applications) on three current environments to see the differences: PHP 5.6, HHVM 3.11 and PHP 7.0.1.

Since the first functional versions of PHP 7.0.0 were made available, there have been a number of benchmarks comparing PHP 5.6, HHVM and PHP 7. [...] The recently released eZ Platform is a CMS built on the Symfony framework. It's a good representation of a modern PHP application with complex functionalities and no legacy code from the 2000's. Thus making a good candidate benchmarks for testing an application built with the Symfony Framework (version 2.7.8).

So let's see how an application built with the Symfony2 framework fares on PHP 5.6, HHVM 3.11 and PHP 7.0.1.

He starts by describing the test setup including the default installation of the eZ platform and how it was configured/set up. He then shares the results, showing memory usage and response times for each of the three different platforms. There's even results from different parts of the application: the front page and the "Top Stories" and "Projects" pages. The results also include the findings for the number of requests per second both with and without the Symfony Proxy included in the platform.

tagged: symfony benchmarks php56 hhvm php7 requestspersecond memory consumption graph

Link: https://www.symfony.fi/entry/symfony-benchmarks-php-56-hhvm-and-php-7

Joshua Thjissen:
Benford’s law in frameworks
Dec 10, 2015 @ 17:10:50

Joshua Thijssen has an interesting post to his site talking about Benford's Law, related to digits and how frequently they would appear in results based on significance.

In a new talk I’m currently presenting at conferences and meetups, I talk – amongst other things – about Benford’s law. This law states that in natural occurring numbers, the first digit of those numbers will most often start with a 1 (around 30% of the time), and logarithmically drops down to the number 9, which occurs only 5% of the time.

[...] Even though there is no guarantee that something will actually follow Benford’s law, a lot of things do, and in fact, it can be used for things like fraud detection: in your taxes, in elections, but basically anything concerning numbers. [...] But anyway, I wanted to see Benford’s law in action for myself, so I’ve come up with a simple test: Take a (PHP) framework, and count the line-numbers for each PHP file in the framework.

He shares the script (well, command) he uses to get these counts and how he did the sorting to help make some sense out of the results. He includes some of the results and graphs showing them to help visualize the Benford’s "curve" the results take. Interestingly enough, most of them follow the trend very closely with only slight variances for Zend Framework v2 and only them because it fluctuates more, nothing to do with the quality of the framework.

tagged: benfordslaw trend line count framework graph results

Link: https://www.adayinthelifeof.nl/2015/12/09/benfords-law-in-frameworks/

Platform.sh:
Creating flamegraphs with XHProf
Jul 30, 2015 @ 15:08:27

The Platform.sh blog has a post showing you how to create flamegraphs with XHProf for your application's execution and overall performance. A "flamegraph" is just a different sort of graph stacking up the execution times for the methods and functions in your application so they look more like a "flame" than just numbers.

One of the most frequent needs a web application has is a way to diagnose and evaluate performance problems. Because Platform.sh already generates a matching new environment for each Git branch, diagnosing performance problems for new and existing code has become easier than ever to do without impacting the behavior of a production site. This post will demonstrate how to use a Platform.sh environment along with the XHProf PHP extension to do performance profiling of a Drupal application and create flamegraph images that allow for easy evaluation of performance hotspots.

While they show it at work on a Platform.sh instance, the method can be altered slightly to work with your own application with the right software installed. Their example uses the brendangregg/FlameGraph library to do the majority of the graphing work. He shows how to have the code switch on XHProf during the execution and where to put the file for later evaluation. They include the resulting directories and files created from the execution and how to view the resulting (SVG-based) graphs directly in a browser.

tagged: xhprof flameframe execution performance graph tutorial platformsh

Link: https://platform.sh/2015/07/29/flamegraphs/

Luciano Mammino:
Symfony security: authentication made simple (well, maybe!)
Jun 04, 2015 @ 15:36:41

Luciano Mammino has a quick post to his site with information that tries to help make Symfony authentication simple (well, maybe).

The Symfony2 security component has the fame of being one of the most complex in the framework. I tend to believe that's partially true, not because the component is really that complex, but because there are (really) a lot of concepts involved and it may be difficult to understand them all at once and have a clear vision as a whole.

[...] Going back to the Symfony2 security component, the point is that I found out difficult at first glance to get a clear idea of what is going on behind the scenes and what I need to write to create a custom authentication mechanism. So in this post I will try to collect few interesting resources that helped me understanding it better and a graph I drawn to resume what I learned.

He provides a good list to some of the other resources that helped him along the way including several blog posts and links to the Symfony "cookbooks" about creating custom providers. He also shares a graph showing the full flow of the Symfony authentication process including commentary about each step.

tagged: symfony authentication simple resources graph flow provider

Link: http://loige.co/symfony-security-authentication-made-simple/


Trending Topics: