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

Jordi Boggiano:
PHP Versions Stats - 2015 Edition
Nov 23, 2015 @ 13:17:54

It's come to "that time of year" again and Jordi Boggiano has posted the latest update in his series of PHP usage statistics. In this summary he looks at the PHP versions installed based on the packagist.org logs for developers using Composer.

It's that time of the year again, where I figure it's time to update my yearly data on PHP version usage. Last year's post showed 5.5 as the main winner and 5.3 declining rapidly. Let's see what 2015 brought.

[...] A quick note on methodology, because all these stats are imperfect as they just sample some subset of the PHP user base. [...] 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. Of course this data set is probably biased towards development machines and CI servers and as such it should also be taken with a grain of salt.

He first compares the statics for his 2015 searches against the 2014 stats and shows the differences in usage for PHP versions 5.3.3 up to 5.6.0. Fortunately, the results show a rise in the usage of PHP 5.5 and a decline in all others...but it's not too much of a difference (2-3% range). Pie graphs are also included to help visualize these differences. He also includes some statistics on what PHP versions are required by certain packages for the ones listed on Packagist with increases starting with 5.4 and the largest advance for 5.5.

tagged: usage statistics version comparison yearly packagist composer required

Link: http://seld.be/notes/php-versions-stats-2015-edition

Create a Custom API in Magento: Part Two
Jul 03, 2015 @ 10:54:02

NetTuts.com has posted the second part of their series showing how to create a custom API in Magento. In part one of the series they focused on creating a custom module that worked with the core APIs and system. In this new post they approach it from the other side and show how to use those APIs created in part one.

In this series, we're discussing custom APIs in Magento. In the first part, we created a full-fledged custom module to implement the custom API, in which we created the required files to plug in the custom APIs provided by our module. In this second and last part, we'll go through the back-­end section to demonstrate how to consume the APIs.

They start with a quick recap of the things created in the first part of the series and how to ensure it's set up correctly to be accessed as an API endpoint. Next they set up the user and role configurations that you'll need to access the new API through the administration panel. Finally, they show you how to use the API through a simple SoapClient request.

tagged: magento custom api series tutorial part2 usage

Link: http://code.tutsplus.com/tutorials/create-a-custom-api-in-magento-part-two--cms-23821

Peter Petermann:
A few thoughts about composer and how people use it
May 18, 2015 @ 10:17:43

In the latest post to Peter Petermann's site he shares a few thoughts about Composer and how people use it in the more modern PHP ecosystem.

Composer has changed the PHP ecosystem like now other tool introduced – almost everyone is using it today. Now, I have written about Composer before, and have always been a big proponent of using it. However, as i have spend some time with looking more closely on a few things, there is a few problems (some with Composer, some with how people (ab)use Composer) that I would like to write about.

He's broken the list up into six different point, each with a bit of explanation:

  • Composer gets slow and resource hungry
  • People are using composer as an installer
  • People use their own paths
  • People don’t adhere semver
  • People don’t tag their releases / don’t release
  • People release packages with dependencies to unstable versions

He ends the post by looking at each of these points and offering a brief one-liner way to help solve the issue (or at least minimize the problem).

tagged: composer opinion problem usage ecosystem package

Link: https://devedge.wordpress.com/2015/05/16/a-few-thoughts-about-composer-and-how-people-use-it/

Julien Pauli:
Zoom on PHP objects and classes
Mar 26, 2015 @ 12:50:49

Julien Pauli has a recent post to his site that "zooms in" on objects and classes with a look behind the scenes at how they're handled in the PHP source (at the C level) with plenty of code examples and explanations as to how they work.

Everybody uses objects nowadays. Something that was not that easy to bet on when PHP5 got released 10 years ago (2005). I still remember this day, I wasn't involved in internals code yet, so I didn't know much things about how all this big machine could work. But I had to note at this time, when using this new release of the language, that jumps had been made compared to old PHP4. The major point advanced for PHP5 adoption was : "it has a new very powerful object model". That wasn't lies. [...] Here, I will show you as usual how all this stuff works internally. The goal is always the same : you understand and master what happens in the low level, to make a better usage of the language everyday.

The article does a great (if lengthy) job of covering everything that happens with PHP's objects and class system, including stats about memory consumption. He includes both the PHP code and the C code to illustrate what's happening with classes, interfaces, traits and object methods/attributes (including object references). He also talks about what "$this" is and how class destructors are handled.

tagged: object class behindthescenes detail c code memory usage

Link: http://jpauli.github.io/2015/03/24/zoom-on-php-objects.html

Pascal Martin:
PHP Version Statistics - October 2014
Oct 28, 2014 @ 11:23:13

Pascal Martin's latest post (in French, but the English version is coming soon) shares some statistics he's gathered around the usage of various software around the web, more specifically those involved in web-based applications.

I've collected statistics about the use of different PHP versions several times. The first time was in September 2011 and the most recent was in November 2013. At this point, PHP 5.2 still accounted for 34.4% of all PHP installations with PHP 5.3 moving up to 48.7%. This new data was collected the weekend of October 19th, 2014. At this point, the current stable versions of PHP are 5.4.34, 5.5.18 and 5.6.2. PHP 5.3 is no longer maintained (since August 14th 2014) and PHP 5.2 hasn't been supported for 4 years now.

He's broken up the statistics into a few different sections:

  • Web server software
  • Usage of major versions of PHP
  • Usage of minor versions of PHP
  • Versions in use under each of the major version numbers

He includes both the raw numbers (percentages) and some graphs showing the results in a bit more consumable fashion. It's interesting to see that, despite it being quite an old version now, PHP 5.3.x still has the largest share in the usage results.

UPDATE: He's posted the English version now as well.

tagged: usage statistics oct2014 version major minor webserver

Link: http://blog.pascal-martin.fr/post/statistiques-versions-php-2014-10

Joshua Thijssen:
Internal PHP function usage: revisited
Aug 06, 2014 @ 11:53:34

Joshua Thjissen has revisited some of his PHP internal function statistics, an update from this previous post with some results showing the most (and least) used internal PHP functions in several large projects from GitHub.

A lot of people are asking about functions like isset, empty, print, echo etc, as they are not present in the current result list. The thing is, is that these are not really functions, but language constructs. This means that PHP treats them a bit different than normal functions, and this results sometimes in seemingly “strange” behaviour when trying to use them like regular functions.

He's updated his results, though, to reflect the usage of these "functions" and shared the numbers. Not surprisingly, these constructs show up pretty highly in the new "top 22" list he's produced. With the inclusion of the constructs, the number one item on the list is now "isset" by a very large margin. The full results can be found in this gist.

tagged: internal function usage statistics github revisit construct language

Link: https://www.adayinthelifeof.nl/2014/08/05/internal-php-function-usage-revisited/

Joshua Thijssen:
Internal PHP function usage
Jul 28, 2014 @ 10:05:39

Curious about the usage of the various "internal" (built-in, not user defined) functions in use is a wide range of PHP applications, Joshua Thijssen did some research on GitHub and has shared the results on his site today.

How many internal PHP functions (things like count(), strpos(), array_merge() etc), does PHP have? Depending on which version you use, and how many extensions you have loaded, somewhere between 1000 and 2000 would be a good guess. But how many of these internal functions are you REALLY using?

He created a custom script to fetch the results of a custom query (one that found repos with over fifty stars), grabbed the source and parsed the results looking for these internal functions. He shares the results of his parsing from 967 repos in the remainder of the post, including: the top ten most called, some interesting facts found in the results and some of the "bad" ones in wide use (like "exec" and "mysql_connect").

tagged: internal function usage statistics github parse query

Link: https://www.adayinthelifeof.nl/2014/07/25/internal-php-function-usage/

SitePoint PHP Blog:
How to Speed Up Your App's API Consumption
Apr 11, 2014 @ 10:51:23

The SitePoint PHP blog has some advice posted today from Jacek Barecki about how you can speed up your use of other APIs with a few performance increasing tips.

In the process of creating a PHP application you may come to a point when keeping it isolated from remote resources or services may become a barrier in its development. To move along with the project you may employ different API services to fetch remote data, connect with user accounts on other websites or transform resources shared by your application. [...] But using APIs in an incorrect way can quickly lead to performance issues and lengthen the execution time of your script. If you’re looking for a way to avoid it, consider implementing some of the solutions described in the article.

He recommends four things you can think about doing to help make the most effective use of these services:

  • Make multiple requests at a time
  • Separate API calls from the app main flow
  • Build a smart cache engine
  • Master the API documentation
tagged: api performance recommendation tips usage

Link: http://www.sitepoint.com/speed-apps-api-consumption/

Erika Heidi:
Vagrant Usage Research
Jan 27, 2014 @ 10:15:07

If you've never heard of the powerful tool and you need automation around creating and configuring multiple virtual machines, you really should check it out. If you're curious as to how it's being used and what kind of things it's used for, check out this new post from Erika Heidi based on some research she recently did (and a survey she received some good feedback to).

From 11 to 14 of January, 720 Vagrant users from different sources (Twitter, IRC and the official Vagrant mailing list) answered a quick form I created to find out how people are using Vagrant. I’m currently in the process of writing a LeanPub book about this tool, and I was really curious especially about the provisioners usage.

She's put together the results in the form of an easy to read infographic with details about:

  • The most popular provisioners
  • The percentage of boxes running with OS
  • The percentage of languages on the boxes
  • The OS most Vagrant users use

...and finally the answer(s) to the question of "why vagrant?" but I'll leave it to you to read the post to find out that one.

tagged: erika heidi vagrant usage research infographic survey

Link: http://www.erikaheidi.com/2014/01/24/vagrant-usage-research/

Kevin Schroeder:
(Basic) Configuring the Magento 2 Dependency Injection Container
Dec 16, 2013 @ 12:03:22

Kevin Schroeder continues his series of posts looking at using Magento 2 and creating customizations of the application. In this latest post he builds on the previous post about dependency injection and shows how to configure Magento's container.

The purpose of that post was to, perhaps, make you less apprehensive about using DI combined with the DIC in Magento 2. However, in this post I want to go a little deeper into the DIC, implemented via the MagentoObjectManagerObjectManager class, and talk about how to configure it. Configuration for the DIC is done in each module’s etc/di.xml file or etc//di.xml. Because you can split DIC configuration based on the area this tells you that the /config/ naming stuff is over; which I applaud.

He focuses more specifically on two of the child nodes that can be defined - "type" and "preference" (you can also have "virtualType" as well). First up is "type" and he gives a simple example class in his "HelloWorld" example that just takes in a message and returns it when asked. He shows it in use and how to set up the "di.xml" configuration for the class, defining the "message" parameter in the configuration instead of in the object fetch (like the first example).

tagged: magento2 dependency injection container configuration usage tutorial

Link: http://www.eschrade.com/page/basic-configuring-the-magento-2-dependency-injection-container/