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

Kinsta Blog:
The Definitive PHP 5.6, 7.0, 7.1, 7.2 & HHVM Benchmarks (2018)
Feb 28, 2018 @ 19:18:38

The Kinsta blog has published an article they call the Definitive PHP 5.6, 7.0, 7.1, 72. and HHVM benchmarks providing a comparison between these different versions running different popular PHP software (including WordPress, Drupal and Magento 2).

Each year we try and take a deep dive into performance benchmarks across various platforms and see how different versions of PHP and HHVM stack up against each other. This year we went all out and benchmarked four different PHP engines and HHVM across 20 different platforms/configurations; including WordPress, Drupal, Joomla!, Laravel, Symfony, and many more. We also tested popular eCommerce solutions such as WooCommerce, Easy Digital Downloads, Magento, and PrestaShop.

[...] The results this year have drastically changed from our previous benchmarks where HHVM was the winner. We now are excited to see PHP 7.2 as the leading engine in terms of speed. [...] This is great news for developers and end-users alike as it means more of a focus back on PHP and providing faster websites and web services for everyone.

The post then starts with a look at the system setup (well, Google Cloud instance) that's used for the testing and how it is configured. From there it goes into the test results from each of the different types of software:

  • WordPress
  • Drupal
  • Joomla!
  • Magento 2
  • Grav CMS
  • October CMS
  • Laravel
  • Symfony
  • PyroCMS
  • Pagekit
  • Bolt
  • AnchorCMS
  • PrestaShop
  • CraftCMS
  • ForkCMS

As you can see there's more of a leaning towards content management and e-commerce solutions in their list. It's good to see base frameworks in the list too, however. For each item in the list they provide a graph of the results showing requests per second.

tagged: benchmark php71 php72 hhvm php56 php70 software compare

Link: https://kinsta.com/blog/php-7-hhvm-benchmarks/

Romans Malinovskis:
Objectively comparing ORM / DAL libraries
Dec 21, 2017 @ 18:19:38

In a new post on his Medium.com site Romans Malinovskis has posted an objective comparison of ORM/DBAL libraries based on his own list. It includes several different libraries from all around the community including Doctrine, Eloquent, Cake ORM and Agile Data.

For many of us, developers, pattern of accessing external data (SQL) is a thing of preference. We get used to different syntaxes and subjectively endorse it. By looking past the individual preferences, I wanted to create a “comparison criteria” that would help PHP community to objectively evaluate data persistence frameworks based on features. As I looked around I haven’t found anything, so I started to work on my own list:

https://socialcompare.com/en/comparison/php-data-access-libraries-orm-activerecord-persistence. I welcome my readers to help me populate and use the table. In this article I explain various features which I’ve used as comparison criteria.

The (lengthy) post is divided up into sections for each of the criteria including:

  • Sections and Scope
  • Support of Persistence Engines
  • Criteria, Scope, Condition
  • Query Building
  • Single-record operations
  • Relations and References

...just to name a few. Each section comes with an explanation of what it is in a library-agnostic way and code examples where relevant. Be sure to check out both the table and the rest of the post for the full details.

tagged: compare orm dbal library chart criteria summary features

Link: https://medium.com/@romaninsh/objectively-comparing-orm-dal-libraries-e4f095de80b5

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

Johannes Schlüter:
References - Still bad in PHP 7
Feb 19, 2016 @ 15:18:45

Johannes Schlüter has a post to his site that talks about references in PHP 7 and how they're "still bad" based on some of his previous findings.

I'm known for telling "Don't use references" (also as video) as those cause different problems (i.e. with foreach) and hurt performance. The reason for the performance loss is that references disable copy-on-write while most places in PHP assume copy-on-write. Meanwhile we have PHP 7. In PHP 7 the internal variable handling changed a lot among other things the reference counting moved from the zval, the container representing a variable, to the actual element. So I decided to run a little test to verify my performance assumption was still valid.

He includes his testing code that calls a function (strlen) in a loop and compares the handling against two methods, one passing by reference the other not. The results are shown in time taken to execute. He compares the results for PHP 5 and PHP 7, noting that PHP 7 is marginally better when passed by value, by-reference is still about the same.

tagged: reference php7 php5 compare value byreference byvalue test benchmark execution

Link: http://schlueters.de/blog/archives/180-References-Still-bad-in-PHP-7.html

SitePoint PHP Blog:
Building Microsoft’s What-Dog AI in under 100 Lines of Code
Feb 16, 2016 @ 18:38:28

On the SitePoint PHP blog there's a tutorial posted from editor Bruno Skvorc where he attempts to replicate the "What-Dog" application recently created by Microsoft in under 100 lines of code. It makes use of the Diffbot service to do the actual detection and evaluation.

Rather recently, Microsoft released an app using AI to detect a dog’s breed. [...] In my non-SitePoint time, I also work for Diffbot – the startup you may have heard of over the past few weeks – who also dabble in AI. To test how they compare, in this tutorial we’ll recreate Microsoft’s application using Diffbot’s technology to see if it does a better job at recognizing the adorable beasts we throw at it!

He walks you through the installation and configuration of the software you'll need (and account you'll need to create). From there he shares the code to take in the user's upload, send it as a POST request over to the Diffbot service and returning the relevant results. He finishes out the article with a comparison of the two services, posting various images and seeing which comes closer.

tagged: whatdog ai tutorial diffbot api dog compare microsoft

Link: http://www.sitepoint.com/building-microsofts-what-dog-ai-in-under-100-lines-of-code/

Barry vd. Heuvel:
Comparing Blade and Twig templates in Laravel
Aug 26, 2015 @ 15:02:32

Anyone that has looked at using a templating library in their application has probably come across both Blade (in Laravel) and the Twig libraries. In a post to his site Barry vd. Heuvel compares these two templating libraries based on their features, security and (briefly) performance.

In my company, we use Twig instead of Blade for our Laravel projects. I know there are a lot of developers that also prefer Twig over Blade. So the question ‘Why choose Twig over Blade?’ often pops up. The reason is usually just a matter of preference, but in this post we’re going to compare the Blade and Twig templating engines side-by-side.

He starts with an "about" for each library, giving some basic background and examples of simple templates. He talks about using Twig in Laravel (vs Blade) and then lists some similarities and differences between the two. Following this high-level list he gets into more detail on each feature of the libraries including:

  • Outputting variables
  • Control structures
  • Template inheritance and sections
  • Security and context

Each section includes a description of the feature and a template example showing how it's put to use. He ends the post with his thoughts on which one you should pick for your project, but notes that, like many things in development, the answer is "it depends" on your project and team's needs.

tagged: compare blade template twig library feature overview example

Link: http://barryvdh.nl/laravel/twig/2015/08/22/comparing-blade-and-twig-templates-in-laravel/

SitePoint PHP Blog:
Console Wars – PHP CLI Libraries
Jul 27, 2015 @ 14:32:35

The SitePoint PHP blog has a post that compares some of the major PHP CLI libraries, three of them at least: the Symfony console component, Hoa console and the Webmozart solution.

I have always been a big fan of console commands and I try to provide a command line interface (CLI) as much as possible in most of my PHP projects. In this article, I’ll briefly compare three PHP console command libraries.

He starts with a brief history on each of the libraries, talking about their origins and age. He then talks about the necessary dependencies each requires and the overall complexity of the code they include. Next up is some practical examples putting each to use outputting a simple message back to the user using user input for both the message and output color.

tagged: console commandline library symfony hoa webmozart cli compare

Link: http://www.sitepoint.com/console-wars-php-cli-libraries/

Michelangelo van Dam:
Speeding up database calls with PDO and iterators
Jul 27, 2015 @ 13:45:28

In a post to his site Michelangelo van Dam shows you how to speed up database calls with PDO and iterators in a "no framework" environment.

When you review lots of code, you often wonder why things were written the way they were. Especially when making expensive calls to a database, I still see things that could and should be improved.

When working with a framework, mostly these database calls are optimized for the developer and abstract the complex logic to improve and optimize the retrieval and usage of data. But then developers need to build something without a framework and end up using the basics of PHP in a sub-optimal way.

He points out some of the common issues with a simple approach using just PDO and simple arrays including performance issues. Instead he recommends the use of iterators that wrap a PDO connection and allow for much simpler fetching and iteration of the found results. He includes code examples for a base iterator instance and a way to extend it to get the customized results. He also includes a few benchmarks showing the difference between a foreach loop and this iterator method.

tagged: database pdo iterator foreach benchmark compare

Link: http://www.dragonbe.com/2015/07/speeding-up-database-calls-with-pdo-and.html

Dan Miller:
Comparing the PHP 7 and Hack Type Systems
Apr 29, 2015 @ 13:31:43

Dan Miller, a core platform engineer at Etsy, has a new post on his personal site sharing his results from a comparison of the variable typing systems between the Hack language (created by Facebook) and what's coming in PHP7.

One of the exciting things about PHP 7, aside from the incredible performance improvements, is the introduction of scalar type hintingHack. I wanted to find out if you could execute the same code in PHP 7 and Hack, and what the differences in execution might be. Here's what I found out.

He starts by describing his setup (the versions of PHP7 and HHVM he's using) and shares a few simple examples. He uses the same(ish) code in both and points out some of the differences in what happens when each is executed. He also points out some of the differences in the features between the two (such as Hack not allowing for default arguments with a value of null). He tries a few more complicated things too, like mixing strict and non-strict files, and the findings. He ends the post with some of his overall thoughts of his results and his excitement about what the future holds for PHP7 and the hinting it will provide.

tagged: compare php7 hack type systems variable statictypehints hinting hhvm

Link: http://www.dmiller.io/blog/2015/4/26/comparing-the-php7-and-hack-type-systems

Vertabelo Blog:
Side by side: Doctrine2 and Propel 2
Apr 13, 2015 @ 14:55:10

On the Vertabelo blog Patrycja Dybka has put together a side-by-side comparison of Doctrine 2 vs Propel 2, two of the more popular PHP-based ORM tools, largely popular in the Symfony communities.

When you start working with data in an application, you may need to use an object-relational mapper (ORM), a layer between the database and application. For PHP the two most frequently used ORM's are Doctrine and Propel. That's why I decided to compare the main features of Doctrine in version 2.4.7 and Propel in version 2.0.

She doesn't try to pick a "winner" but instead talks about the features of each and the main difference between the two (ActiveRecord vs DataMapper patterns). The remainder of the post is the side-by-side listing of the feature of each including:

  • Install method(s)
  • Model structure definition types
  • Mappings
  • Supported databases

There's also some examples in the list of code to define tables, perform basic CRUD (create, read, update & delete) operations, basic queries and custom data types each includes. It's a good comprehensive list if you're trying to make a decision between the two or even just looking to find out what each has to offer.

tagged: doctrine2 propel2 sidebyside compare features examples

Link: http://www.vertabelo.com/blog/technical-articles/side-by-side-doctrine2-and-propel-2-comparison


Trending Topics: