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

July 2017 Issue Released - Safe at Speed
Jul 12, 2017 @ 12:07:57

php[architect] magazine has posted their latest issue, the July 2017 edition of the magazine - Safe at Speed:

“Safe at Speed” includes articles on:
  • Setting up infrastructure from Zero to Cloud in One Hour With the Google Cloud by Robert Aboukhalil.
  • Geogriana Gligor writes on Smart, Scalable Content Distribution.
  • Brush up your front end skills with Modern JavaScript: Moving Beyond jQuery by Derek Binkley.
  • Learn how and why we must of safety first when writing code in The Train Wreck: When Safety Is Discretionary by Ed Barnard .

The regular columns are all returning too including Community Corner and a new column from Chris Tankersley called "The Dev Lead Trenches". You can get more information about this latest issue, pick up a free article and get a copy of your own from the php|architect site.

tagged: phparchitect magazine july2017 safe speed issue release

Link: https://www.phparch.com/2017/07/safe-at-speed-july-2017/

5 New Features In PHP 7 That You Should Have A Look At
Oct 19, 2016 @ 09:43:05

If you've heard about the release of PHP 7 but aren't quite sure what it has to offer, check out this quick post on the StartTutorial site giving you a "top five" list of things this new version of the language has to offer.

But you must be wondering why PHP named its latest release PHP 7 and not PHP 6. Reason behind it is that, many of the PHP 6 releases were already implemented in PHP 5.3 and later, there was not really a proper reason just to change the name. What I am trying to say here is that we haven’t missed anything. Just to avoid the confusion with a dead project, PHP's latest release was named to PHP 7.

Is This Hype Valid for PHP 7? What It Actually Brings Forth for the Developers? Hop on and let’s take a deeper dive. Let's check out what new features PHP 7 has to offer. And what improvements those features will bring forth.

Their top five list covers some of the major improvements in the language:

  • Speed Improvement
  • Implementation of Type Declarations
  • Implementation of Error Handling
  • New Operators
  • CSPRNG Functions

There's a bit of explanation of each item on the list but you'll definitely want to refer to the PHP manual for more details and specifics on what changed in PHP 7.

tagged: php7 feature top5 list speed typing errors operators csprng

Link: https://www.startutorial.com/articles/view/5-new-features-in-php-7-that-you-should-have-a-look-at

Dries Vints:
Two tips to speedup your Laravel tests
Aug 25, 2016 @ 09:15:48

In this recent post to his site Dries Vints shares two quick tips you can use to help speed up the execution of the tests for your Laravel application.

I've seen two different tips for speeding up your tests in Laravel in the past week and thought I'd share them with you. For me, they made a significant impact on the speed of my tests.

His two tips involve lowering the "cost" factor on the number of "rounds" the user password is hashed and the use of a pre-computed hash in your testing factories. These both help reduce the overhead needed, especially when working with tests that need to create the user every time. He includes code and reference links for more information about these two tips and applying them in your testing.

tagged: speed performance laravel test hashing rounds precomputed

Link: https://driesvints.com/blog/two-tips-to-speedup-your-laravel-tests/

Chema Garrido:
Speed test PHP vs Lumen vs Laravel
Aug 18, 2016 @ 12:08:53

Chema Garrido has written up a post sharing some results of a performance test (speed) between Lumen and Laravel also comparing it against Kohana and straight PHP.

I am working in the new EmailValidator!, and after developing the EU VAT API, I feel confident to develop it on Laravel Framework. But before we start… let’s test the speed of the stack.

I used my local computer a 8 cores i7 2ghz 8GB ram 512SSD. Apache2, PHP 7.0.8. Tested this test with siege 5 times for each and retrieved the highest.

The first part of the post shows the results in a tabular format but following this is the more detailed version, complete with the siege command executed and the code used. The results are interesting but seem to mostly fall into the real of micro-optimization as there's really not that much difference between the results (though the "Longest transaction" on the plain PHP code is an oddity).

tagged: laravel lumen performance speed test results framework

Link: https://chema.ga/speed-test-php-vs-lumen-vs-laravel/

Loïc Faugeron:
Super Speed Symfony - nginx
Apr 20, 2016 @ 10:48:49

Loïc Faugeron has continued his series about speeding up Symfony applications and getting the best overall performance you can. In this new post he gets into more detail about tuning a Nginx web server (with PHP-FPM) and the web server's own caching features.

HTTP frameworks, such as Symfony, allow us to build applications that have the potential to achieve Super Speed.

We've already seen a first way to do so (by turning it into a HTTP server), another way would be to put a reverse proxy in front of it. In this article we'll take a Symfony application and demonstrate how to do so using nginx.

He starts by helping you get Nginx and PHP-FPM all set up and running on a Unix-based system (installed via apt-get). He provides a simple configuration including the user to run as and a virtual host for the application. There's a few command line checks to ensure it's working correctly and a bit of benchmarking as a baseline for the performance testing later. He then gets to the caching functionality and gives some of the basics on how it works inside of Nginx itself. He includes a basic caching configuration (caching to files) and adding this to the already created virtual host. Finally he includes sample Symfony code to send the "Cache-Control" header with every request and runs the benchmarks again (resulting in about 140x faster than without the cache).

tagged: tutorial nginx performance symfony speed phpfpm setup configuration cache cachecontrol

Link: https://gnugat.github.io/2016/04/20/super-speed-sf-nginx.html

Jani Hartikainen:
Why is fixing bugs so slow? (and how to make it faster)
Dec 17, 2015 @ 12:06:32

On his CodeUptopia blog Jani Hartikainen has posted a great article with some of his thoughts about why fixing bugs is so slow and includes a few suggestions on how to make it happen faster and streamline the process for the future.

Have you ever wondered why sometimes fixing bugs seems to take much longer than it should? When you finally find the problem, it turns out all you need is one small change. Yet, it took a lot of time to find what’s going on. This happens to me more often than I’d like.

[...] Why is it that sometimes fixing bugs takes a lot of work even when the problem is simple, and other times, it’s really quick to fix the problem – maybe even when it isn’t so trivial? Is there something we can learn from the bugs that are easy to fix, so that we could spend less time fixing bugs in general?

He starts off by describing a typical bug fixing process after the initial discovery and reporting of the issue down to the actual fix being deployed. He then breaks down each of these six steps and provides more context around them:

  • Understanding the problem
  • Reproducing the bug
  • Finding the problematic piece of code
  • Identifying the root cause
  • Fixing the bug
  • Ensuring the bug is fixed

He then goes back and talks about the pain points in this typical process citing things like a lack of good information around the bug and the time constraints that often come with the "time to fix" allowance. He makes some suggestions about how to gather better information around the issue before the fix begins and points to effective logging as one possible source. He also talks about how unit testing can help verify the bug is actually fixed and help to prevent and locate future issues.

tagged: bugfix speed slow opinion process unittest faster advice

Link: http://codeutopia.net/blog/2015/12/16/why-is-fixing-bugs-so-slow-and-how-to-make-it-faster/

SitePoint PHP Blog:
Speeding up Existing Apps with a Redis Cache
Jul 28, 2015 @ 10:27:06

The SitePoint PHP blog has posted a tutorial that want to help you speed up your applications with Redis, adding in caching to help reduce the overall processing load your app has to expend.

The application in question, when executing a query, runs off to Diffbot’s API and makes it query the dataset. The subset is then returned and displayed. This can take up to 5 or so seconds, depending on the busyness of Diffbot’s servers. While the situation will undoubtedly improve as they expand their computational capacity, it would be nice if a query executed once were remembered and reused for 24 hours, seeing as the collection is only refreshed that often anyway.

Considering the fact that implementing this cache costs us literally nothing (and actually reduces costs by reducing strain on the servers), adding it in is an easy win, even if it weren’t used as often as one would hope. There is no reason not to add it – it can only benefit us.

He helps you get Redis up and running as a service on the local system and installing the Predis, the PHP library you'll use to talk with Redis for setting and getting the cached information. He includes a few code snippets showing how to send the search off to the DiffBot API, return the results and push them into the cache as serialized data with a day long timeout. He also mentions the phpiredis extension to reduce some of the overhead that could be cause by using a PHP library versus an extension.

tagged: speed performance redis cache tutorial introduction predis phpiredis

Link: http://www.sitepoint.com/speeding-up-existing-apps-with-a-redis-cache/

SitePoint PHP Blog:
Caching Hat-trick: Zend Opcache, Etags and Query Caching
Jul 13, 2015 @ 09:57:56

The SitePoint PHP blog has posted three tips on caching that can help speed up your application from the processing level up. The article shares tips on using opcode caching for faster processing, etags for web request caching and query caching on the data side.

In this article, we will be looking at some of the common caching techniques in PHP: Opcache, Expires Headers and Query Caching in MySQL. We’ll look at additional approaches in part 2.

He starts with an introduction to the request lifecycle of a typical request made to a PHP-based application, from the fetching of a file to the actual execution. This lays the groundwork for the first kind of caching: opcodes for caching execution results. He helps you get that enabled and configured and shows how to determine how much it's actually helping. Following this he talks about the "expires" headers you can send from Apache, telling the browser exactly when it needs to fetch new versions of things like CSS, image or Javascript files. Finally he touches on MySQL query caching, storing the already parsed version of a query on the server with results in a cache for faster polling on repeated requests.

tagged: caching zend opcode etags expires query caching tutorial speed performance

Link: http://www.sitepoint.com/caching-hat-trick-zend-opcache-etags-and-query-caching/

Osedea Blog:
Speeding up your ZF2 application
May 11, 2015 @ 16:30:36

On the Osedea blog today there's a new post showing you a few ways you can speed up your Zend Framework 2 application with a few easy code changes.

After about a year developing a Zend Framework 2 application, we decided it was time to do some optimizations. Page load times were up to several seconds on our bigger pages, and none of our pages were loading in under 2 seconds. We took a few days to profile our application and scour the various ZF2 articles out there to see what could be done to reduce the load times. We found some pretty obvious causes as well as a few inconspicuous ones. Here’s a brief list of our findings, along with some steps on how to improve your ZF2 applications.

Their list includes updates around:

  • Standard vs Classmap Autoloading
  • Event Listeners
  • Making your Module.php "skinny"
  • Cache Settings
  • Session Write Close

Each tip includes a bit of code showing what will need to be changed, making it easy to drop them in and make your application nice and speedy.

tagged: zendframework2 application speed performance

Link: http://blog.osedea.com/2015/05/11/speeding-up-your-zf2-application/

Using Plugins to Speed Up WordPress
Feb 23, 2015 @ 09:54:06

On the NetTuts.com site today they've posted the first part of their "Speeding Up WordPress" series - Using Plugins to Speed Up WordPress. In this start to the series, they show you how to use two methods to speed up your WordPress installation: using caching and database optimization.

One of the most popular talking points in the WordPress community is speeding up WordPress and optimizing web pages. I don't think there is a WordPress blog without an "X Tips to Speed Up WordPress" article. Don't get me wrong, it's a good thing. But we need better articles about this topic instead of dull plugin round-ups. This may look like yet another "tips for speeding up WordPress" tutorial, but in this three-part series, we're going to go through every aspect of optimizing and speeding up your WordPress website.

They start with caching and show how do both client and server-side caching using techniques both inside and outside of WordPress itself. They also link to two plugins to help with the server-side handling. Following the caching talk they look at optimizing the database. They point you towards the WP-Optimize plugin as the best way to squeeze the most performance from your database (without breaking how WordPress works).

tagged: plugin wordpress speed optimizae cache database

Link: http://code.tutsplus.com/tutorials/using-plugins-to-speed-up-wordpress--cms-22055