PHP Annotated Monthly – September 2014

PHP Annotated MonthlyHere at JetBrains, we strive to help PHP developers with excellent tools like PhpStorm that improve our code and workflow. But there’s more to developing PHP applications than that: learning from others and keeping up with what’s going on out there so we can improve our own code.

In this post, I’ll be highlighting the most interesting content from around the web, posted by developers like us. This type of post is an experiment: we don’t know yet if we’ll be doing it monthly or not. It’s up to you! Would you be interested? Or not? Let us know what you think in the comments below.

PHP

PHP 5.6 was released, bringing a number of new language features PhpStorm like exponentiation via **, use function and use const, constant expressions, variadic functions, argument unpacking and so on. The PHP website has a great guide on all of them, including some easy to understand samples. I’ve also written a blog post that explores two of these features: variadic functions and the __debugInfo() magic method.

Which is going to be the next major version of PHP? One would think 5 + 1 = 6, but because that branch was closed back in 2010 (and some other reasons), the votes have decided PHP 7 will be next. PHPClasses.org posted a comprehensive overview of the discussion and talks about what’s next for PHP in terms of performance, compilation steps, JIT, asynchronous programming and so on.

Did you know PHP is not the only PHP interpreter? Lukas Kawhe Smith looks at the “alternative PHP’s” and the future of PHP from a distance. Oh, and Facebook’s HHVM now comes with long-term support.

Frameworks

Laravel is quite popular nowadays for building web applications. Aleksander Koko wrote about building single-page applications with Laravel and EmberJS. This 4-part tutorial covers everything from setting up the project to creating REST services and calling them from the browser.

Bye bye Symfony. When I read the title I got really confused. It’s a great framework and provides many components that can be used even in applications not using the full framework. Marc Morera discusses exactly that: how to write code that uses just the components needed.

Using Symfony? You may want to read more about Daniel Espendiller’s excellent Symfony plugin for PhpStorm that makes development much more efficient. The guy never sleeps, it seems, as he did a similar thing for Drupal 8.

Speaking about Drupal 8… Angie Byron posted another installment in the Ultimate Guide to Drupal 8, a blog series on the changes Drupal 8 brings for end-users, site builders, front-end developers, and for back-end developers.

The first hours of my week were spent updating several WordPress sites to the latest WordPress 4. Benny, as this release is called, brings updates to content, media and plugin management making the whole experience smoother to work with.

Being both a .NET and PHP guy, I once ported .NET’s LINQ (Language INtegrated Query) to PHP while on a plane. Behold, the abandoned PHPLINQ project! Ever since, a number of alternatives came about of which the recent Pinq looks very promising. Taylor Ren wrote a tutorial about it, explaining how we can get started with writing queries on any data structure (arrays or an actual database) using nothing but… PHP.

Community/other

Users expect applications to be fast, fast, fast. Since the twenties or thirties (it could be later, just making up dates here), PHP has the concept of output buffering and streaming. Imran Latif explains these concepts and how they can make these expectations come true..

Haven’t heard of Composer? Or haven’t tried it yet? Paul Underwood wrote a tutorial on getting started with Composer in PHP. If you have heard of it, you may want to learn how to host your own Packagist using Toran Proxy to mirror public packages and host in-house libraries without having to share them with the world.

IDE’s like PhpStorm use Abstract Syntax Trees (AST) to be able to reason about the code that is being written, for example to figure out where code must be updated during refactorings. While we write them in Java, Nikita Popov wrote one in PHP. Being able to reason about PHP code using PHP code is fantastic, as we can do things like rewriting namespaces to pseudo-namespaces. Or write a PHP interpreter. In PHP. Anthony Ferrara started work on Recki-CT, a compiler toolkit for PHP that compiles PHP code into machine code rivaling performance of many native implementations.

Too many applications are assuming they will be deployed on the root of the virtual host! Michael Kimsal made this interesting discovery and questions application portability with many popular frameworks.

I remember a project where I had to find the distance between two points. My math brain failing (as I have no math brain), I Googled the Internet for a solution. Sander van Thillo explains how to solve this in MariaDB and ElasticSearch.

My wife asked me recently how she could get started learning PHP. That’s a very difficult question to answer! Good thing I saw a link to an interesting discussion about this on Chris Cornut’s excellent PHPDeveloper.org, which also aggregates interesting news from the PHP world.

We’re pondering about doing this sort of post monthly. Does it make sense? Let us know what you think in the comments below. If you have any news or content you’d like to see here, feel free to reach out to @maartenballiauw on Twitter.

Develop with pleasure!
– JetBrains PhpStorm Team


Get PhpStorm 8

image description