PHP Digest: PHP5 and Optimizer+, Zend Studio 10, Avoiding Nulls in Code and Much More

February 26, 2013

News and Releases:

  1. Will Open Source Zend Optimizer+ be available in PHP 5.5? — despite the statement of Zend co-founder Zeev Suraski that Zend Optimizer+ may be included in PHP 5.5, the vote on this issue has not started yet, while the Alpha 5 has been already released and the first beta version 5.5 is going to be launched in the beginning of March. Still this is very positive news that Zend has now fully open sourced code under the PHP license and it's available for everyone! See the project repository and the installation instruction here.
  2. PHP 5.4.12 and PHP 5.3.22 released — another update and as usual the changelog inside.
  3. PHP 5.5.0alpha5 — an unplanned alpha release, which in addition to bug fixes, contains small improvements in API MySQLi and Mysqlnd and several others. The full changelog see here.
  4. Zend Launches Zend Studio 10 — as it was announced before the emphasis in the new version of the IDE was placed on the development of a backend for mobile apps and integration with cloud services.
  5. Bolt 1.0 released — after six months of work the first stable version of the CMS based on the Silex framework and Symfony components was finally released.

PHP:

  1. Why objects use less memory in PHP than arrays do — an excellent post by Nikita Popov, an active PHP developer. At first glance, it seems obvious that the objects must use more memory as they're nothing else than the arrays of properties + some additional info. But the matter is that in most cases, PHP optimizes massive components of the objects. Learn more about how it works from the post. Note that the info is relevant only for PHP 5.4 and higher.
  2. RFC: Trailing comma function args — the list of arrays in PHP can be completed with commas: array ('Foo', 'Bar',). The current RFC contains a  proposal to add the ability to complete a list of the function's arguments with a comma similar to the arrays: function ($ foo, $ bar,) {}.
  3. If this is really a dumb idea for PHP core? — the author of the post offers to include some method in PHP that would allow us to cache the state of the application at the start of requests. In general, something similar to APC and Zend Optimizer + for object and data caching, but not opcodes. It's quite interesting but hardly ever will happen.
  4. The mysterious PHP RFC process and How the web can be changed — for anyone who is interested in how new features get into PHP, the author wrote a wonderful post telling us about the RFC process, making it more transparent for ordinary developers. The author gives a lot of useful tips and advice for those who want to participate in the language development and who have something to offer.

Training Materials:

  1. Bottleneck analysis (PDF) — Slides from the report of a core-PHP Developer Ilya Alshanetsky introduced on PHPUK 2013 — the largest PHP conference held in London recently.
  2. Closures, lambdas, and anonymous functions — these concepts are often interchangeable in PHP, but is it right? In the post the author answers the question what is the difference between lambdas, anonymous functions and closures describing their PHP features.
  3. RESTful APIs with ZF2, 2 — a set of posts on RESTful APIs development including Zend Framework 2. Part 1 describes the REST basic principles, Richardson Maturity Model, Hypertext Application Language and how it can be used to determine the general structure of JSON resources. Part 2 contains a description of such aspect of RESTful interfaces as error messages. The author states that it's not enough to return the code of an error and suggests two possible solutions: vnd.error and API-Problem. Both articles do not cover ZF2, so they will be useful to everyone.
  4. Avoiding Nulls in PHP — how often do you have to write something like “if (null === $ obj)” in your PHP code? Inspired by Scala and Google Guava, the author offers a more elegant solution using the Option class.
  5. PHP libraries with known security issues should not be used — any developer using Composer to manage dependencies, has the ability to find potential security problems automatically using security.sensiolabs.org. Users can download the “composer.lock” file, and the system will check the dependencies on known issues and will make a report. Moreover there is an API to automate the test. Vulnerability Database is available on GitHub, and anyone can help in its completion, just making a pull-request.
  6. Safety in PHP Dependencies with Composer — some more recommendations on safety in the dependencies managed using Composer.
  7. CSRF attacks preventing — the widely discussed post that refers to the generation of secure CSRF-tokens. The author offers a method to generate less predictable and more secure values. A closer look at the issue and CSRF in general was taken by Anthony Ferrara in his post.
  8. Testing models in Lavarel — an excellent detailed tutorial on organizing unit testing in Laravel 4.
  9. Simplifying test data generation with Faker — a good tutorial with examples of using the Faker library, designed to generate data similar to real data for testing.
  10. Interview With PPI — the PHP Meta-Framework - PPI is a PHP framework that includes the best of Zend Framework 2, Symfony2 and Doctrine2. The author of the framework answers various questions, such as why PPI is a meta-framework, what a meta-framework really means.
  11. Setting up a staging environment — an excellent detailed tutorial on how to set up a staging environment using  Vagrant (CLI for VirtualBox). The author makes the configuration very similar to Fortrabbit, but any configuration of desired environment can be easily set up for any other PaaS/hosting.
  12. How to create user groups — the post published in the php | architect magazine. The author shares tips on creating user groups: search for local developers interested in meetings, dissemination of information through the companies that use PHP; searching for sponsors and partners and others.
  13. External processes and PHP — a small tutorial on how to run and use external processes using streams.
  14. How to extract the necessary excerpt from a WAV file — the post contains a review of WAV format and WAV file structure. The author also describes how to use the Audero Wav Extractor library to extract excerpts from WAV files.
  15. Lithium: building views using layouts — a small tutorial on Lithium framework.
  16. Parsing XML with SimpleXML — an easy and detailed tutorial for those who are not experienced with parsing XML in PHP.
  17. PHP streams for everything — another small tutorial on how to work with data streams in PHP.
  18. Scaling Silex applications — a small post that describes how you can use YAML to configure routing. The author cites the extension code (SilexRouteExtension) and provides examples of its use.
  19. My Love/Hate relationship with PHP Traits — another post in which the author describes not only benefits, but also disadvantages of the traits' new opportunities.
  20. Working with Slim Middleware — the author tells us what a “middleware” is and how Slim, a PHP microframework, can be used as a layer in the middleware stack. An example is implementation of a caching Slim layer. See more examples on GitHub.
  21. phpswitch — a CLI utility that allows users to create and test PHP versions.
  22. Programming with Anthony – Design patterns — training videos by Anthony Ferrara, the famous PHP participant. This time the subject is revealed not by Anthony, but by Larry Garfield - one of the Drupal 7 Module Development authors. See all the videos here.
  23. API Authentication: HMAC with public/private keys — the post describes how to validate API requests using pairs of public and private keys.
  24. Why Yii framework development is ruling the world — a PHP based easy-in-use Yii framework with user friendly frames appeared to be one of the best PHP frameworks of 2012. The post describes the main reasons that made the software well known and popular among developers when building creative web apps.
  25. 24 cool PHP libraries you should know about — a set of good libraries for all occasions: routing, caching, ORM, benchmarks, validation, filtering, payments processor, and many others.
  26. Interfaces or abstract classes? — if you aren't sure which OOP tool to choose: an interface or an abstract class - then this post will be useful for you as the author describes their benefits and gives recommendations on which one to choose.
  27. Wrapping a PHP class for easy method chaining — an author of the post demonstrates a simple method of creating a wrapper for an existing class that implements the possibility to create chains a la jQuery.
  28. Dependency injection should not be overused – The author shows how excessive use of dependency injection can degrade the code quality.
  29. Avoid the original MySQL extension, Part 1, 2 — It's not a secret that the original MySQL extension for PHP became completely outdated, but still often used. This two-part post describes what is actually wrong with MySQL extension as well as MySQli and PDO which are considered as an alternative to MySQL.
  30. PHP5.5: Try/Catch/Finally — Starting with PHP 5.5 the “finally” block was added to try/catch exception. The author of the post shows some examples of using new features experimenting a little. For example, even if there is a “return” statement in a try/catch block, the “finally” block will still work properly.
  31. 6 Reasons why PHP is a hobbit — not so long ago there was a question on Quora: If there is a war of programming languages who would you support and why? In one of the responses each programming language was described as a race/character from Lord of the Rings, where PHP was compared to an orc. The author of the post says that PHP is still a hobbit advancing his arguments for this point of view.
  32. The definitive PHP style guide — if you don't like the adopted standards, PSR-0, 1,2, then pay attention to this one - it's beautiful.

Do you have an awesome business idea? Let’s make it real!

Join our newsletter!

Get weekly updates of the top IT news delivered straight to your inbox

OFFER OF THE MONTH

Magento website development. Empower your online store!