2015年3月11日星期三

Community News: Recent posts from PHP Quickfix

Recent posts from the PHP Quickfix site:

Bosnadev.com: Using Repository Pattern in Laravel 5


Mirza Pasic has posted a tutorial to the Bosnadev.com site introducing you to the repository design pattern and how to use it in a Laravel 5-based application.



These days there is a lot of buzz about software design patterns, and one of the most frequently asked questions is "How can I use some pattern with some technology". In the case of Laravel and the Repository pattern, I see often questions like "How I can use repository pattern in Laravel 4″ or nowadays "..in Laravel 5″. Important thing you must remember is that design patterns do not depend on specific technology, framework or programming language.


He starts with a brief overview of the Repository pattern, just to catch everyone up to speed (complete with a diagram for extra effectiveness). He then talks about the role interfaces play in the structure and where in the Laravel directory structure he recommends placing them. He configures the "composer.json" file to autoload them correctly and gets into his actual implementation. He creates a system to work with the push and pull of movie/actor/rental data including the code to make not only the specific repository instances but the generic class they inherit from. Next he creates the "criteria" object type to help with searching the data and makes a few examples ("length over two hours", "rental below three"). Finally he shows how to use this criteria searching in a controller to create custom queries and result sets.


Link: http://bosnadev.com/2015/03/07/using-repository-pattern-in-laravel-5/

Coen Jacobs: Updating PHP is everyone's responsibility


In his latest post Coen Jacons suggests that updating PHP is everyone's responsibility - that keeping the PHP installation on your systems up to date is important for everyone, not just the system administrators.



The number one remark I heard when I launched WPupdatePHP, is that users shouldn't be bothered with this. In an ideal world, this is true, but in reality this isn't going to stand for long. [...] I know the WordPress core team is working really hard to get webhosting companies to update their PHP versions and I agree up to a certain level that this is the best way. It's not the only way though. [...] This will help lower the percentage of PHP 5.2 and 5.3 users out there. There still will be people on older PHP versions who are caught out and without them knowing what is going on, nothing will change for them.


He talks about the efforts the WordPress core team is doing to try to convince hosting providers to update, but points out that while WordPress aims to run on those old versions, staying on them is a mistake. He also mentions that an effort like this is a constant thing, always changing as the PHP versions released change. He ends the post with a "call to arms" for users out there, encouraging them to get talking to their hosting provider and get those PHP versions updated.



Don't understand me wrong, I like what WordPress is doing to get these requirements bumped, but I think it's not enough. I disagree on the fact that users shouldn't be involved in this. It's easy enough for users to request their hosting platform to be upgraded. If their request isn't heard, they should find a better webhosting company. [...] It's been long enough, I choose to act now.

Link: http://coenjacobs.me/updating-php-everyones-responsibility/

Halloapp.com: A Journey into Microservices


On the Hallo.com blog Matt Heath has posted a series of articles about their transition from a "monolith" codebase out into a set of microservices for the Hallo app system.



Hailo, like many startups, started small; small enough that our offices were below deck on a boat in central London - the HMS President. Working on a boat as a small focused team, we built out our original apps and APIs using tried and tested technologies, including Java, PHP, MySQL and Redis, all running on Amazon's EC2 platform. [...] After we launched in London, and then Dublin, we expanded from one continent to two, and then three; launching first in North America, and then in Asia. This posed a number of challenges-the main one being locality of customer data.


They describe this customer data problem in a bit more detail with the issue mostly revolving around the geolocation of the user and their information. They talk about "going global" and the steps they took to make the move. In the three parts of the series, they explain the changes they made and why they were effective for their application:




They end the series with some links to other resources that help compliment the subjects mentioned and link to slides from a presentation around the same topic.


Link: https://sudo.hailoapp.com/services/2015/03/09/journey-into-a-microservice-world-part-1/

Rafael Dohms: Why I support "The League"


Rafael Dohms has posted some if his own thoughts to his site about The League of Extraordinary Packages and why he supports their efforts to bring a good solid base of curated packages to the PHP ecosystem.




"The League of Extraordinary Packages" is what I have dubbed a collective of composer packages. Its essentially a group of developers who have gathered under a single flag (or in this case a vendor name) and set standards for the packages that live there.



Why does this even matter? Well for one Packagist is an open repository, this means that it is wide open for anyone to join, from the best packages to the most ridiculous ones. Quality control is not one of its roles and quality checking is on average 2-3 clicks per package away.




He talks about the quality control measures The League has in place to only contain good, well-tested and solid PHP packages. He also lists a few of his main reasons for supporting the effort including the fact that it reduces author fragility and provides an extended reach for those packages to reach a wider audience.



I really enjoy the work being done by The League, or The PHPLeague, or Pleague as I prefer to call it. I think it has provided us with some very good packages and given us all something to strive for. Maybe more collectives is what we need.

Link: http://blog.doh.ms/2015/03/10/why-i-support-the-league/

2015年3月10日星期二

Community News: Latest PECL Releases for 03.10.2015

Latest PECL Releases:
  • APM 2.0.2
    Fixed:
    - Compilation issue on non ZTS setup


  • APM 2.0.1
    Fixed:
    - #10: Bad configure message (thx @RemiCollet)
    - #11: Bad version reported (thx @RemiCollet)
    - #13: ZTS build is broken (thx @RemiCollet)
    - APM not working with XDebug
    If Xdebug is enabled as in xdebug_enable() or xdebug.default_enable, APM error callback will not be called.
    Use xdebug.default_enable=0 or xdebug_disable() to go through APM error handling.

    Improved:
    - #12: Installation of files via pecl install
    - StatsD driver (thanks @0livier for the discovery!)

    Changed:
    - Web frontend located on its own repository: https://github.com/patrickallaert/php-apm-web


  • uopz 2.0.7
    fix bug in overriding methods in classes loaded prior to override
    add ability to send object from ZEND_NEW handler
    send exit parameter to overload function
    fix bug in handling exit status code when overloading disabled
    set exit status code when overloading enabled from return value


  • couchbase 2.0.5
    This is a patch update to the PHP 2.0 SDK.

    Changes:
    * Orphan: Corrected issue where durability checking may not propagate errors.
    * PCBC-327: group_level semantics now support server 3.x.
    * Orphan: Corrected issue with some ViewQuery methods.
    * PCBC-326: Zero-length strings no longer decode as NULL.


  • redis 2.2.7
    phpredis 2.2.7

    -- Improvements ---

    * Implemented PFADD, PFMERGE, and PFCOUNT command handling
    * Implemented ZRANGEBYLEX command (holding off on ZREVRANGEBYLEX
    as that won't be out until 3.0)
    * Implemented getMode() so clients can detect whether we're in
    ATOMIC/MULTI/PIPELINE mode.
    * Implemented rawCommand() so clients can send arbitrary things to
    the redis server
    * Implemented DEBUG OBJECT (@michael-grunder, @isage)
    * Added/abide by connect timeout for RedisArray
    * Select to the last selected DB when phpredis reconnects

    -- Fixes ---

    * Fix a possible invalid free in _serialize
    * Added SAVE and BGSAVE to "distributable" commands for RedisArray
    * @welting -- Fixed invalid "argc" calculation re HLL commands
    * Allow clients to break out of the subscribe loop and return context.
    * Fixes a memory leak in SCAN when OPT_SCAN_RETRY id.
    * @remicollet -- Fix possible segfault when igbinary is enabled.
    * Add a couple of cases where we throw on an error (LOADING/NOAUTH/MASTERDOWN)
    * Fix several issues with serialization NARY
    * @itcom -- Fix missing TSRMLS_CC and a TSRMLS_DC/TSRMLS_CC typo


  • mongo 1.6.4
    ** Bug
    * [PHP-1400] - Default writeConcern not write safe on standalone node
    * [PHP-1401] - Segfault in findAndModify test running against 3.0.0-rc11
    * [PHP-1402] - MongoCollection::hasNext() returns false for limit=1 result

    ** Task
    * [PHP-1405] - Create regression tests for batchSize(1) and batchSize(-1) behavior


Derick Rethans: Xdebug 2.3: Munging errors


Derick Rethans has posted a new part of his series looking at the improvements that came with the latest Xdebug release (v2.3). In this new article he talks about error handling and intercepting them to make debugging simpler.



One of the first features I added to Xdebug was the interception of error messages, so that it was possible for me to include a stack trace. Xdebug 2.3 has a few additional settings to control the behaviour of interception.


He covers the addition of three new settings: xdebug.halt_level, force_display_errors and force_error_reporting. Each of these is designed to provide you with customizable error reporting. Each setting comes with an example of its configuration and how it modifies the output of the resulting errors.


Link: http://derickrethans.nl/xdebug-2.3-error-munging.html