2014年5月5日星期一

Community News: Latest PEAR Releases for 05.05.2014

Latest PEAR Releases:

Community News: Packagist Latest Releases for 05.05.2014

Recent releases from the Packagist:

Fabien Potencier: The rise of Composer and the fall of PEAR


Fabien Potencier has a new post to his site today talking about a recent trend in the PHP community around dependency and package management, the rise of Composer and the fall of PEAR.



As a good package manager to let user easily install plugin/bundles/MODs was probably also a big concern for phpBB, I talked to Nils about this topic during this 2011 hackday in San Francisco. After sharing my thoughts about libzypp, "..., I [Nils] wrote the first lines of what should become Composer a few months later". [...] So, what about PEAR? PEAR served the PHP community for many years, and I think it's time now to make it die.


He goes on to talk about how he personally has used PEAR in the past and when he stopped work on Phirum, a simplified PEAR channel manager. Based on some logging results, he found that most dependencies on his channels were related to PHPUnit's needs. When Sebastian Bergmann announced the move of PHPUnit away from PEAR Fabien decided to make his own move to deprecate and eventually remove new releases from the PEAR sources.


Link: http://fabien.potencier.org/article/72/the-rise-of-composer-and-the-fall-of-pear

NetTuts.com: Refactoring Legacy Code: Part 3 - Complex Conditionals


The NetTuts.com site has posted the third part of their series sharing some tips for refactoring the code in a legacy application. In part one they looked at the "Golden Master" and in part two about moving away from magic strings and constants.



Old code. Ugly code. Complicated code. Spaghetti code. Gibberish nonsense. In two words, Legacy Code. This is a series that will help you work and deal with it. I like to think about code just as I think about prose. Long, nested, composed sentences with exotic words are hard to understand. From time to time you need one, but most of the time, you can just use plain simple words in short sentences. This is very true for source code also.


Continuing on with this "prose" theme, he gives an example of simplification and reducing the amount of validation needed before completing the task. He compares this to complex conditionals and shares something called the "extract method" to help simplify them. He also looks at directory and file structure and suggests cleanup there as well. The tutorial finishes with a few other suggestions, things like cleaning up "runner functions" reworking negative conditionals.


Link: http://code.tutsplus.com/tutorials/refactoring-legacy-code-part-3-complex-conditionals-long-methods--cms-20944

SitePoint PHP Blog: How to Use the JsonSerializable Interface


Matrin Hardy has a new tutorial posted to the SitePoint PHP blog today showing you how to use the JsonSerializable interface to work with objects and converting them to JSON.



Over the past few years JSON has taken over as the king of data interchange formats. Before JSON, XML ruled the roost. It was great at modeling complex data but it is difficult to parse and is very verbose. [...] I think we could all agree that writing less code that in turn requires less maintenance and introduces less bugs is a goal we would all like to achieve. In this post, I'd like to introduce you to a little known interface that was introduced in PHP 5.4.0 called JsonSerializable.


He splits the rest of the post out into three different parts: the "ugly" method of converting a sample Customer object into a JSON string (through an array), the "bad" method using a "toJson" method and finally the "good", implementing a class that implements the JsonSerializable interface for easy JSON-ification.


Link: http://www.sitepoint.com/use-jsonserializable-interface/

2014年5月4日星期日

Community News: Packagist Latest Releases for 05.04.2014

Recent releases from the Packagist:

2014年5月3日星期六

Community News: Packagist Latest Releases for 05.03.2014

Recent releases from the Packagist: