The digest of interesting news and materials from the world of PHP over the past two weeks, №12 (02/25/2013 - 03/11/2013)
We offer to your attention another selection with links to news and materials.
Enjoy reading! ')
News and Releases
Optimizer + will be enabled in PHP 5.5 - Over the past two weeks, there have been a number of events related to the inclusion of Zend Optimizer + in PHP. A vote was launched, which, we recall, suggested 3 scenarios: 1) Include in 5.5, even if it delayed the release a little; 2) If for integration it is necessary to delay release 5.5, then include it in 5.6; 3) Do not include in PHP, provide only from PECL. First, the package became available from PECL , and then according to the results of Zeev Suraski’s vote in php-internals, the decision was made to include Optimizer + as a zend_extension in the default PHP distribution, and in version 5.6 it is planned to integrate into the kernel. This message has generated a lot of discussions, as some believe that this decision requires 2/3 of the vote. Still, the inclusion of the optimizer does not affect the syntax of the language, and by default the corresponding option in php.ini is likely to be set to Off. Well, rest in peace with the predictable release process of PHP: another alpha, and beta is postponed again. But for the sake of such results, I would like to get the opcode caching out of the box a year earlier.
PHP 5.5.0 Alpha6 Release - The release itself contains only a few bug fixes found in the previous alpha, but is notable for the fact that it serves to delay the release of beta, which will already include Optimizer +.
Symfony 2.2 has been released - The long-awaited release work, which was carried out for 6 months. Read more about the new features in the post. .
Phalcon 1.0.0 First Beta - A year after the birth of this unusual PHP framework, it lived to the first version.
The 12th edition of the Web & PHP magazine - The anniversary issue (the magazine has been published for a year now) covers the following topics: using recursion in PHP; using PECL; error correction in production using APM and many others.
About PHP-FIG - Matthew Weier O'Phinney, the architect and leader of the Zend Framework project, said he was leaving PHP-FIG , the group that accepts PSR standards. In a post, he gives the reasons that forced him to make such a decision. In short, there are more important things that the author would like to spend time than arguing about how to use tabs or spaces, where to put braces, etc.
Php
How foreach actually works - The most detailed answer to StackOverflow that you might have encountered. Core PHP developer Nikita Popov dot the foreach loop.
The next big thing in PHP - Having described their vision of the current state of affairs in PHP, the authors of the post say that if everything continues in the same spirit, then PHP will die soon. Yes, it will live 5, maybe 10 years and die. In their opinion, in order to prevent this, PHP 6 should make drastic changes aimed at performance, and backward compatibility is generally called upon to forget. In addition to such radical statements, the authors make a really important proposal: to create an opportunity for ordinary PHP users to participate in the development of the language. One of the authors even created the corresponding RFC , in which it was suggested to add open polls on php.net in order to get feedback from users.
About the predictable release cycle of PHP - A small post in which the author, in connection with the recent news about Optimizer +, expresses the view that a stable and predictable release process is very important for developers. And the hasty inclusion of ZO + in the language in the form of zend_extension in fact does not give anything: it will not be on shared hosting even in a year, and those who have the ability to use the latest PHP versions on the server can simply put Optimizer + from PECL.
Study materials
Functional programming in PHP - Most recently, the topic has already jumped in the digest and, nevertheless, a good post, which revealed the basic principles of functional programming and their use in PHP.
PHP bloom filter - PHP implementation of a probabilistic data structure that allows you to compactly store the set of elements and check the belonging of a given element to the set. For example, the author applies a filter to check for the existence of a word or phrase in a dictionary of> 10,000,000 words.
Unit Testing for PHPUnit , 2 , 3 , 4 - Completely complete unit testing guide for beginners, in which four parts cover all aspects of using PHPUnit, starting with installation and ending with advanced usage techniques.
Measures that should be taken if your PHP site was hacked - If in the previous post the author looked at diagnostics: how to know that your site was hacked, then this time the “cure” was considered: the steps are listed that will help get rid of the malicious code. In addition, recommendations are given to prevent re-hacking and infection.
We integrate OAuth with the help of Opauth - A small tutorial on the use of a multi-provider framework for authentication via OAuth in PHP applications. In the post an example of integration with CodeIgniter is considered, but there are implementations for all popular frameworks. The list of supported out of the box providers is impressive.
Compliance with PCI and PHP developers - The article briefly describes what PCI standards are, describes the main myths surrounding them, and also gives an overview of the main points. In more detail, the author dwells on the items directly related to the backend development of web applications.
Install XHGui - A small tutorial on installing and using a great tool for profiling code. A slightly more detailed tutorial was already here .
Contributing to Paratest - A small article in which the author describes the advantages of using the Paratest tool for parallel execution of tests, and also talks about new improvements that were proposed by third-party developers and encourages every effort to help and participate in the development of the project.
D means documentation - In a post the author considers the last principle from the LUCID set - documentation. By analogy with TDD, the author proposes his own approach to programming - Documentation Driven Development. This approach assumes that the developer first writes the documentation and comments to the code, then the tests, and after all, he proceeds directly to the code. The post also provides a small example illustrating this campaign (without tests).
Problems, efficiency and attitude of the group PHP-FIG - The news that one of the key figures leaves PHP-FIG, of course, had a resonance. The author of the post, though not a member of PHP-FIG, nevertheless, sets forth practical considerations regarding the future fate of the group. In addition to the post itself, we recommend to pay attention to the comments, which also set out interesting thoughts on the topic.
Valitron That Doesn't Suck - The author tried to find a simple and convenient library for validating user data that was not cumbersome and had no dependencies. Not finding one, the author wrote his Valitron library, which has all the listed features. More examples of usage can be found on GitHub .
Rock On, Refactor, or Re-roll? - Surely you have encountered a situation when developing something for yourself you suddenly for some reason have to postpone development for some time, and returning to the case you find out that you see different parts of code look different and would like to do it differently / it is better. In this case, you have a choice: to continue what was started, refactor or rewrite everything from scratch. Just about such situations this post. The author describes his experience and makes recommendations for making decisions.
Make the conference better - The author of the post loves PHP conferences and often makes presentations on various of them. In the post, he shares several ideas on how to make conferences more useful, and therefore more interesting to a wide range of developers.
RESTful APIs on ZF2, Part 3 - Continuation of a series of articles on building RESTful interfaces. The author continues to describe the general concepts of REST, and this time concerns the documentation of your API.
Overload: create class methods on the fly - In most programming languages, overload means the ability to describe several methods with the same name and a different number of arguments. Overloading in PHP means the ability to dynamically “create” properties and methods. In his post, the author by example shows the use of "overload". The class of access to the database and getting records using getBy methods (for example, by id or username — getById () and getByUsername (), respectively) implemented through the magic __call () is described.
PHP has reached its limit - the author has moved from PHP to Ruby, and in the post he compares solutions of typical tasks on Rails and TYPO3, naturally demonstrating the superiority of the first. Enough already?
Quality of the code - The author believes that the quality of the code is only 30% of talent and 70% of the correct setting of the environment and processes. In the post, the author describes those tools and techniques that he uses to maintain the desired quality.
Tracking the process of performing tasks on PHP - The author wrote a simple library designed to track the progress of performing large-scale tasks, such as batch processing. In addition to the time the library allows you to track the memory used.
PHP frameworks in C - The post discusses the pros and cons of using PHP frameworks that are delivered as language extensions. There, by the way, the author counted two: Phalcon and Yaf . Are there any others?
Link to the previous release. Material prepared by pronskiy