PHP Annotated Monthly – January 2017
Happy New Year! New year, new PHP Annotated Monthly, a roundup of all that’s happened in the last month or so with Gary Hockin, Developer Advocate for PhpStorm at JetBrains.
Don’t forget: you can now get PHP Annotated Monthly delivered to your inbox, so you’ll never miss the monthly roundup again. Sign up here and get next month’s PHP Annotated Monthly delivered right to you.
PHP and Development
The latest versions of PHP are:
The biggest point to note here is the fact that there’s only one version of PHP 5 that’s currently supported, and as of January 1st, 2017, it’s only receiving security fixes. By the end of 2017, PHP 5 will be completely unsupported. 2017 is the year for upgrading your servers to PHP 7.
If you need some pointers installing PHP 7 on your systems, then you could do far worse than Installing PHP 7.1 by Colin O’Dell. TutsPlus also have an excellent post on Upgrading Your Linux Server to PHP 7.0. Sebastien Bergman also published a fantastic article, PHP 5: Active Support Ends. Now what?
Toon Verwerft tells us that using fully-qualified namespaces in our function calls can speed up the code in Optimizing PHP performance by using fully-qualified function calls. Personally, I think that if you’re down to optimization by these small micro-optimizations, then you’re doing it wrong, but at least Toon includes benchmarks.
Quick and easy introduction into PHP Mess Detector (PHPMD) by Leonid Mamchenkov introduces a valuable tool for finding potential problems in your code. PHPMD also plugs into PhpStorm as an external tool or inline inspection; it’s a good thing to use. Chris Pitt on SitePoint always entertains me, and he doesn’t fail with The Delicious Evils of PHP – a fascinating look at when you could and should use the evil functions `eval` and `exec`.
Other enjoyable reads about PHP this month:
- How PHP Executes – from Source Code to Render
- Playing with Docker, Silex, Python, Node and WebSockets
- The Art of Defensive Programming
- Zend Blog: Top 10 PHP articles of 2016
- PHP can’t jump? Thing about recursion
- PECL Request Extension: Beta 1 Released!
- Feature Flags in PHP
- Sessions in PHP 7.1 and Redis
- Let’s Kill the Password! Magic Login Links to the Rescue!
- The Open/Closed Principle
- Building PHP Projects on AWS CodeBuild
Frameworks and Libraries
2017 looks like being the year of great frameworks and libraries (and upgrading to PHP 7 – didn’t you do that already?). One tool I have been guilty of ignoring in 2016 is PHP’s static page generator Sculpin. Interested? Get started with a great series by Mattias Noback: Project documentation with Sculpin.
If you haven’t noticed already, I’m really trying hard in this issue to get you using PHP 7. Laravel Homestead 4.0 is released featuring support for PHP 7.1 by Joe Ferguson tells you how you can use Laravel Homestead to run PHP 7.1 in your virtual development environment. Homestead is a Vagrant-based virtual machine that makes virtualizing your development environment really easy, even if you’re not using Laravel. It’s definitely worth a look.
To really drive the message home about how you should be running PHP 7, read Symfony and Laravel will require PHP 7 soon by Freek Van der Herten. In it, he reveals that the creators of Symfony and Laravel have committed to their next major versions (4 and 5.5, respectively) and those will require PHP 7 as a minimum. Now’s the time to upgrade.
I also read Run PHPUnit Tests From Sublime Text, although why you’d want to be running your unit tests from a text editor is beyond me. Just use a fully purposed IDE. I was intrigued by the post Using Closures as PHPUnit After Hooks by Dave Marshall, hooking into after things have run looks kind of cool but I can’t think of a good use case yet.
Other interesting articles from the month:
- 80 Laravel Tutorials, Packages, and Resources from 2016
- Don’t Hate WordPress: 5 Common Biases Debunked
- Best practices on bundles in Symfony
- Collection Pipelines in PHP
- Laravel Dusk Is Coming to Laravel 5.4
- Writing Better Tests: Expectation vs Implementation
- The Ultimate Guide to Building a WordPress Plugin
- Using Vue in Laravel 5.3, with the Vue bootstrap and sample component
- Using Doctrine DBAL with Zend Expressive
- Mocking Swift Mailer – 3 Steps to better code
- How To Use Forked Repositories In Composer
- Update to queue workers in Laravel 5.3
- Symfony: the Myth of the Bloated Framework
- Natural Language Sorting with MongoDB 3.4
- Scaling Laravel Using AWS Elastic Beanstalk Part 2: Setting up VPC, RDS and Ela
- How to solve PHPUnit issues in Symfony 3.2 applications
- In Laravel 5.4 You Can Use Markdown in Your Emails
- A Subtle Introduction to Mocking
- How To Automate Projects Using Composer Scripts
- Symfony Flex set to enable RAD (Rapid Application Development)
Community, Career and Events
My favorite community/career based post this month was from Robert Basic, Things I learned in the past four years. Robert reveals what he learned in over 4 years on a large project and delivers them in a very enjoyable way. Matthew Turland also makes some good points in his post On Remaining Employable, but I can’t agree with everything. While I agree that you have to spend some of your own time to your own professional improvement (such as attending conferences), I hate the connotation that only coding 9 – 5 as part of a day job is a Bad Thing™. Encouraging developers to work long hours or code outside their day job is a dangerous thing.
Finally, I really enjoyed an interview with Matt Stauffer (Laravel supremo), On becoming a web artisan. Matt’s a nice guy and gave me a copy of his excellent book Laravel Up and Running which I highly recommend.
I’m not going to bother listing the most recent editions of podcasts this month, instead, over the coming weeks I’ll compile a list of PHP adjacent podcasts and include that here. It turns out I don’t need to get my word count up this month, so I don’t need to list episode names blindly.
Conference season is kicking off again, and I’m lucky enough to be asked to speak at a few events early in the year. If you’re at PHP Benelux, Sunshine PHP or PHPUK, then please come over and say hello.
Everyone at JetBrains wishes you a great 2017, and don’t forget, if you’re not running PHP 7, then NOW IS THE TIME!
As always, if there’s anything you’d like me to list here next month, then get in touch.
— Gary and the PhpStorm Team