2012年1月4日星期三

Community News: Latest Releases from PHPClasses.org

Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 1)


Fabien Potencier has written up a new post on his blog talking about creating your own framework layered on top of the Symfony2 framework's component system (yes, a framework from a framework).



Symfony2 is a reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems. Instead of using these low-level components, you can use the ready-to-be-used Symfony2 full-stack web framework, which is based on these components... or you can create your very own framework. This series is about the latter.


He talks about the reasoning behind wanting to make your own framework, mostly dealing with exploration and/or proving you can do it. He walks you through every step of the way - creating the base directory, setting up a project via Composer, creating an autoloader and making a first basic file - a "Hello world" echo message. In the next part of the series, he'll add in the HttpFoundation component for web interaction.

Reddit.com: A Response to "The MicroPHP Manifesto"


On Reddit today there's a rather large discussion going on about the recently posted manifesto from Ed Finkler about building simple, manageable tools rather than using "kitchen sink" frameworks for your applications.



As of the time of this post there's about sixty-five comments posted to the thread with widely ranging opinions:



  • "How is [lots of separate libraries scattered around] better than simply using a framework?"
  • "This is part of the reason for the PSR0 reference for auto loaders [...] Part of the problem is an inconsistent way to load modules."
  • "I would love to see this become a trend in the PHP community. I think this is exactly the direction needed to make PHP exciting again and regain mindshare in the wider dev community."
  • "I know, many people are currently on that micro trip but seriously, I think that there is as much to microframeworks as there is to microoptimization"
  • "A framework is a tool. If you don't need it, why use it?"
  • "There's a tool for ever job, I agree some projects or companies "need" something like Zend or Symfony for their enterprise projects. Whether or not you'd want to work on a project with 1000's of classes is something else all together."


Read the full responses to Ed's article here.

2012年1月3日星期二

Community News: Latest PECL Releases for 01.03.2012

Latest PECL Releases:

PHPMaster.com: Understanding the Command Design Pattern


On PHPMaster.com today there's a new article introducing you to the Command design pattern and looking to help you understand its use a bit better.



The majority of [cell phone] users have opted to receive an email, but a significant number are now opting to receive the notifications via SMS. Here's the problem: How do you send a message via two different channels to both groups of users? The logical approach would be to split the users into 2 groups, email recipients and SMS recipients, which would involve running 2 different queries and sending the codeword to each group separately. Using the Command Pattern, which I will introduce you to in this article, you can send the message to both groups of users in a single process.


He uses the message queue he mentioned as an example - showing how you can can queue up different kinds of objects (actions) based on a common interface into the same process. He creates a "DailyAlertEmail" and "DailyAlertSMS" classes, both with a "send" method. The settings for these are then pulled from a database and the "execute" method on the "MessageQueue" class is called to loop through them, calling "send" to do that work.

Rob Allen's Blog: Sublime Text 2 Snippet for PHP getter and setter generation


In a quick new post to his blog, Rob Allen has shared a snippet for the Sublime Text 2 editor to make creating getters and setters for your class simpler (dynamically too).



As with a lot of editors, Sublime Text supports snippets which are essentially text expansions of a short phrase into more text. I needed to create a few getXxx() and setXxx() methods for some properties of a class and decided that the easiest way to do this would be with a snippet.


Included in the post is the code you'll need to put into the snippet - a simple find (regular expression based) looks at the currently selected variable and expands out the getter and setter for it. For more information on the Sublime Text 2 editor, see the product's website.

2012年1月2日星期一

Kenny Katzgrau's Blog: The Top 10 CodeIgniter Sparks of 2011


Kenny Katzgrau has a new post with the top ten Sparks (CodeIgniter packages) for the year of 2011:



It's a moderately simple app that provides a vehicle for quickly dropping other developers' code in your codebase. Many of the packages on GetSparks are very well maintained. I am continually impressed by the amount of effort spark developers pour into their submissions when I peruse the site and try new packages out. [...] GetSparks has almost clocked 50,000 package downloads at this point, but there are handful of sparks that have really stood out in terms of popularity.


Packages in the top ten list by popularity include (in no particular order) php-activerecord, template, gravatar_helper and markdown. He also thanks a few of the folks that have made the GetSparks.org site what it is.