The digest of interesting news and materials from the world of PHP for the last two weeks No. 5 (November 17, 2012 - November 30, 2012)

    We bring to your attention the next selection with links to news and materials.

    Enjoy reading!

    News and Releases


    • PHP the Nice Way - An excellent post in which the author shares his experience in programming in PHP, talks about his mistakes and discoveries. The post is full of useful tips and tricks.
    • Use the best API in your PHP MySQL application - Currently, three interfaces are available in PHP for working with MySQL, namely ext / mysql, ext / mysqli and PDO_MySQL. A discussion arose in php.internals about the need to exclude obsolete ext / mysql from the default distribution and migrate to PECL. In his post, the author reveals this topic in detail, gives a thorough comprehensive comparison of the three interfaces.
    • PHP: The Testing Era - According to the author, over the past decade the PHP community has gone through several important stages: the transition to OOP, the security of web applications, the use of frameworks, code standards, and at the moment there is a stage that can be called the testing era.
    • If it's not written in PHP it's irrelePHPant! - The author, not without some share of humor, calls on the PHP community to actively write their own tools exclusively in PHP.
    • 3 strange facts from PHP that you might not know about - If you program in PHP long enough, then for you this post will be just a reminder of the non-obvious behavior of real numbers in PHP or of the "effects" of loose typing. However, if you are a beginner, these facts may be a revelation.
    • PHP Trends - A small application that displays a list of PHP libraries, frameworks, etc. (repositories on GitHub) sorted by popularity. The popularity index is the number of repositories that have been added to favorites.
    • Simplified Password Hashing - Some time ago, Anthony Ferrara proposed incorporating a standardized hashing interface into the PHP core. The proposal was supported by voting , and then implemented and already included in PHP 5.5. The author of the proposal in his post tells the details of the new functionality and answers the most frequently asked questions about this.
    • Run command line programs as functions in PHP - The author was inspired by Python Python sh and created something similar for PHP. Using the tool developed by him, you can do such things, for example: $ sh-> ssh (array ('', '-p' => 1393)) -> tail (array ("/ var / log / dumb_daemon.log ", 'n' => 100)); and that would be tantamount to calling: ssh -p 1393 tail /var/log/dumb_daemon.log -n 100 from the command line.

    Learning Materials

    • Migrating to Dependency Injection - An interesting post in which the author describes in detail the process of changing the code of a small application that does not use DI to one that uses.
    • We create our own framework based on Symfony2 components - In the 11th issue, the author will tell us about the capabilities of HttpKernelInterface, adding an increasing number of listeners to the request. This is a very convenient way to test and debug an individual feature, and then simply integrate it into the flow of the request, where necessary. Previous issues: 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10
    • Single Responsibility Principle - Continuing to consider SOLID principles . This time we will talk about the letter "S". To begin with, the author in a post demonstrates a violation of the principle by the example of a class that, in addition to processing user data, also implements the database access functionality. Then the author refactor the code, breaking one class into several new ones, each with its own responsibilities.
    • Paradigm Soup - In this short video, a well-known figure in the PHP community, Anthony Ferrara talks about the difference between procedural, object-oriented and functional programming and how they intersect in code.
    • Encoding - Another video from Anthony Ferrara, this time about encoding information.
    • How to pretend that you are not indifferent to your work - An interesting report on what to do (PHP) to a developer for his own development.
    • What's new in Zend \ Form will appear with version ZF 2.1 - Translation of Michaël Gallego 's article on updates of the Zend \ Form component in ZF 2.1 (new elements, element manager, short names, dependencies and completely updated file loading). Original.
    • Questions and thoughts of a newcomer about rendering on the client side - The author first wonders about rendering on the client side, comparing the rendering on the server and the client, as well as analyzing the difficulties that may arise when rendering content on the client side. It offers a solution to identified problems and answers the question of when it is possible to use rendering on the client side and how ZF2 can be used for this.
    • Debugging and profiling in PHP with Xdebug - A detailed tutorial on using the basic features of Xdebug. NetBeans is used as an IDE for debugging.
    • Improving the performance of Zend Framework 2 - There is still a small list of tips and tricks aimed at improving the performance of applications on ZF2. The author plans to constantly replenish the list, collecting tips and tricks from different sources in one place.
    • Creating a Shopping Cart Class - A detailed tutorial on implementing an OOP-style shopping basket from Larry Ullman.
    • Do not drag your dependencies - In this article, the author first explains why in some cases it is necessary to pull dependencies in Symfony2 and then why this is not worth doing in other cases.
    • Separation of application code from the framework - The author writes that in most cases the application code is highly dependent on the framework, and also gives recommendations on how to weaken such connections as much as possible.
    • Nginx configuration for Symfony2 - Dotting over NGINX configuration for Symfony2 applications.
    • PHP.Kryptik.AB - Give Me Your FTP! - The post is about a malware walking around the network for a long time, which steals passwords from FTP servers and then, connecting to them, embeds malicious code into the found PHP scripts. The author tells how infection occurs, how to disinfect the site and how to prevent re-infection.
    • Validation and filtering in PHP - The topic is old, and nevertheless, the author considers typical security threats, talks about what validation is. He gives an example implementation using a standard extension for filtering data; it concerns an implementation on Symfony 2, Laravel 3, CakePHP 2 and also shares his own module for filtering data.
    • Getters and setters - magic that needs to know their place - The author explains why he considers using getters and setters in the usual way not a good idea, and gives an example when they were really needed.
    • Strictly Typed JSON in PHP - Continuation of the previous post about the unusual use of setters.
    • Create a query designer in PHP - A small note on creating a simple query designer.
    • Your first acquaintance with Phalcon , 2 - Having appeared recently, this framework is rapidly gaining popularity. The reasons are clear: Phalcon is written in C and comes as a native extension for PHP, hence the highest performance. This article is an excellent tutorial from the authors of the framework. In the first part, a description and overview of the features, in the second - a simple blog application. Also on topic an article is available on Habré
    • Zend Framework Day 2012 - Most recently, a conference was held in Kiev on the Zend Framework and PHP. Conference slides are available on the conference website. There is also an interesting report.

    CMS / CMF

    • TYPO3 CMS 6.0 released - A new version of the once popular, but recently continuously losing ground, CMS has been released. Let's see if the latest version changes the trend.
    • WordPress Plugin Releases

      • bbPress - the plugin allows you to create a full-fledged forum based on WordPress.
      • Knews Multilingual Newsletters - allows you to create high-quality multilingual subscriptions.
      • WP Subscriber Form - Adds a subscription form to content.
      • BackWPup - allows you to back up the database and files of your WordPress site.
      • Theme-Check - a tool for theme developers, allows you to automatically check the topic for compliance with standards.
      • WP SlimStat is a simple but powerful analytics plugin.
      • Force Password Change - requires the user to change the password during the first login to the site.
      • Batcache - allows you to use Memcached to cache rendered pages.
      • Edit Flow - provides custom statuses, a calendar, editorial comments and other features to facilitate the sharing of a site on WordPress.
      • No Weak Passwords - prohibits the use of weak passwords.
      • Automatic Updater - auto-update plugins, themes and kernel.
      • BuddyPress Media - allows users to upload and share images, videos and audio with other members of the social network built on BuddyPress .
      • Ice Visual Revisions - adds to the editor the ability to visually display the difference between revisions.

    And finally

    Link to the previous issue.
    Material prepared by dbritan , nesttor and pronskiy

    Also popular now: