2012年1月31日星期二

Community News: Latest PECL Releases for 01.31.2012

Latest PECL Releases:

Marcelo Gornstein's Blog: Writing PHP applications with Doctrine2 as ORM and Ding as DI container


In a recent post Marcelo Gornstein takes a look at using dependency injection with Doctrine2 using his Ding container.



This article will show how we can develop software in php with a nifty design and architecture, and very much like other languages like java, using an ORM and an AOP, DI, Events container. I will assume you've read (or at least took a quick look) at this article that explains the tree layout used throughout the code, and that you have some basic knowledge of Doctrine2 and used it before on your own.


He starts with the result - an easy to use, self-contained (and decoupled) system for accessing the Doctrine2 instance. It's event-driven and uses Aspect-oriented programming to mange interactions between components (or as he calls them "beans"). Code is included for the entire process for a logger, the User entity, entity manager, user repository and transactional aspect. You can find the complete source for his example on his github account.

Charles Sprayberry's Blog: DI and global state


In response to some of the comments made on his previous post about why you should use dependency injection in your applications, Charles Sprayberry is back with some more concrete examples showing how it all works with some code to back it up.



To help better explain each of the three aspects of DI I discussed in the previous article I'll be going over each more thoroughly and with those code examples requested. I'll be going through each point one at a time as the explanations will likely be of some length compared to the original post.


He starts with the "villain" of the story - the Singleton design pattern, a difficult to test method that lulls you into thinking you're not in the global scope. He talks about the problem of using this approach and how the Factory design pattern can be used to create an alternative. He changes up the example to create a "DbTableFactory" class that can be used to create the objects needed - in this case a "UserTable" object with the connection injected into it at construct time.

PHPClasses.org: PHP 5.4 Features: Shall you Upgrade to the newer PHP Version?


Over on the PHPClasses.org blog today there's a new post looking at the next major upcoming PHP version (5.4), what it comes with and why you might want to make the upgrade.



PHP 5.4.0 is planned to be released on February, 2 2012. By the time you are reading this, it may already been out. It is a result of many months of development. Many features were proposed for this release. Some made into this version, others did not make it at least for now. So, now you may be wondering which interesting features really made it. Let me tell you more about some of the more interesting features present in this release.


The article mentions some of the usual major features that can be found in just about every "in PHP 5.4" list - traits, the built-in web server, binary notation for integers - but it also includes some of the features that didn't make the cut this time (like annotations and the inclusion of the APC caching extension). Also included are questions to ask to see if the upgrade is for you like:



  • Do you need the new features?
  • Do you need the updates now?
  • Try it and test it in dev first - does it meet your needs or cause other bugs?


The planned release for PHP 5.4 is during the first week of February (2012). Additionally, if you'd like to give the PHP development group some help testing out the latest Release Candidate, you can find instructions here.

2012年1月30日星期一

Community News: Latest PEAR Releases for 01.30.2012

Latest PEAR Releases:

7php.com: Interview With Stefan Koopmanschap Symfony Community Manager


On 7php.com there's a new interview with Stefan Koopmanschap, the Symfony Community Manager (and well-known PHP speaker and member of the PHPBenelux user group) answering some questions about himself, Symfony and the PHP community.



In this edition, I talked with Stefan Koopmanschap (@skoop) the co-founder of the Dutch PHP usergroup PFZ.nl which is merged with the PHPBelgium usergroup to form the PHPBenelux usergroup. He is also an official Sensio training partner for Benelux and Germany. [...] Koopmanschap is much involved in the OpenSource world and is a very highly respected member in the PHP Community; he advocates sensible thoughts and never fails to make his point stand out in the best way he can. You can read more about him on his personal blog - LeftOnTheWeb.

Stefan answers a few questions about himself and his experience with PHP:



  • A bit of background on who he is and when he got started with PHP
  • How he got started with the language
  • His opinion of PHP now versus when he first started
  • some of the good and bad things about PHP


You can read interviews with other PHP community members here.

Nikita Popov's Blog: htmlspecialchars() improvements in PHP 5.4


In this new post to his blog Nikita Popov looks at an update that might have gotten lost in the shuffle of new features coming in PHP 5.4 - some updates to htmlspecialchars.



One set of changes that I think is particularly important was largely overlooked: For PHP 5.4 cataphract (Artefacto on StackOverflow) heroically rewrote large parts of htmlspecialchars thus fixing various quirks and adding some really nice new features. Here a quick summary of the most important changes: UTF-8 as the default charset, improved error handling (ENT_SUBSTITUTE) and Doctype handling (ENT_HTML401,...).


He goes into each of these three main features in a bit more detail, providing code to illustrate the improved error handling and the new flags for Doctype handling (covering HTML 4.01, HTML 5, XML 1 and XHTML).