2012年11月30日星期五

Site News: Popular Posts for the Week of 11.30.2012

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 11.30.2012

Recent releases from the Packagist:

Scott Mattocks: C is for Configurable


Scott Mattocks has posted the next in his "LUCID development" series of posts with the next letter in the acronym, "C" for Configurable:



As code moves through the software development process, it moves through different environments. In many cases, the full details of then environment may not even be known at the time development starts. Getting your code to change its behavior on the fly is only possible if you have carefully and thoughtfully interleaved configuration parameters into your code.


He talks about handling configuration for external systems and the responsibility that comes with access to the connection information for resources. He makes some recommendations as to where to start if you're looking for places in your code to change how configuration options are used - low hanging fruit like code that accesses external systems.



Other parts of this LUCID series so far are: L (Logging) and U (Unit tests).

Paul Jones: Aura: First 1.0.0 Stable Library Releases!


As Paul Jones mentions in this new post to his site, the Aura Framework project has just released it's 1.0 stable version of all of its packages. The Aura project provides independent library packages for PHP 5.4+. These packages can be used alone, in concert with each other, or combined into a full-stack framework of their own.



The Aura Project for PHP 5.4 is happy to announce its first release of 1.0.0 stable library packages. [...] In addition, we have initial beta releases of four new libarary packages. [...] While the above packages are completely independent of each other, Aura also has a Framework package that binds them all together.


Packages included in the v1.0 of the framework include Aura.Cli, Aura.Http and Aura.Signal. Beta packages are things like Aura.Filter and Aura.Intl.



You can find out more about the project from its site over on github.

2012年11月29日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

Community News: Packagist Latest Releases for 11.29.2012

Recent releases from the Packagist:

PHPMaster.com: Living Apart Together: Decoupling Code and Framework


On PHPMaster.com today there's a new post (by Remi Woler) that looks at abstraction and keeping functionality out of the framework and more decoupled in case the need for switching environments/frameworks comes up.



Of course you develop using the latest technologies and frameworks. You've written 2.5 frameworks yourself, your code is PSR-2 compliant, fully unit-tested, has an accompanying PHPMD and PHPCS config, and may even ship with proper documentation (really, that exists!). When a new version of your favorite framework is released, you've already used it in your own toy project and submitted a couple of bug reports, maybe even accompanied with a unit test to prove the bug and a patch that fixes it. If that describes you, or at least the developer you want to be: reconsider the relationship your code has with the framework.


He talks some about the dependencies most code written today has on the frameworks it lives in and how a good project design can make it easier to decouple this relationship. He suggests using things like wrapper classes (think "services") to abstract out the functionality to custom components. It's these components that handle the work, just reporting back the results to the controller/model that called them.

Qafoo.com: Black Magic with Regular Expresions


If you've been mystified by regular expressions in the past and want to learn more about their effective use, you should check out these two webcasts from Qafoo - "Black Magic with Regular Expressions" and "Understanding Regular Expressions".



We are happy to announce the availability of my second Regular Expression webinar recording. It was a fun event, which I used to explain all the attendees a little bit more about the PCRE Regular Expression engine available in PHP and some other languages. I am covering some slightly advanced topics, like subpattern options, unicode and backtracking aka. greediness and performance.

You can watch these two recordings over on the Zend.com site:


2012年11月28日星期三

Community News: Latest Releases from PHPClasses.org

Community News: Packagist Latest Releases for 11.28.2012

Recent releases from the Packagist:

Derick Rethans: Mongo is dead, long live MongoClient


In this recent post to his site Derick Rethans mentions the shiny new "MongoClient" class that the latest release of the Mongo PHP drivers provides.



This afternoon we published version 1.3.0 of the MongoDB PHP driver. Besides a number of bug fixes since RC2 and RC3, this new release also includes a new MongoClient class. This new MongoClient class serves as a replacement for the Mongo class. The old Mongo class is now deprecated and will be removed in a future release, although we are keeping it in place for now because of backwards compatibility reasons. We have already removed it mostly from the documentation, and are working to update all our other material as well.


The main change that comes with the MongoClient class is that it now has acknowledged writes on by default (a "safe mode"). This option determines wether or not the client waits for a confirmation from the server when a write has happened. He includes a bit of code showing how to: turn it off, keep it on or using replica set acknowledged writes. You can also set it on a per-query basis.

Community News: PHP Newsletter Announced - PHP Weekly


Wes Mason has started up another project to provide you with a weekly dose of curated PHP content direct to your mailbox - the PHP Weekly Newsletter:



[The newsletter is a] curated weekly injection of hot PHP links for your inbox, including the latest articles of interest, videos from talks and tutorials, new projects and of course the latest news in PHP language and platform development. I promise to try to keep links fresh, comments relevant and the hate out of sight.


The first edition of the news letter will be coming out in about a week (on December 6th), so if you'd like to sign up, head over to the main site for the project and enter your address.

2012年11月27日星期二

Community News: Latest PECL Releases for 11.27.2012

Latest PECL Releases:

Community News: Packagist Latest Releases for 11.27.2012

Recent releases from the Packagist:

PHPMaster.com: PHPFog is Coming to an End - But Don't Panic!


If you're a PHPFog user, you know that they're discontinuing the service in favor of their AppFog product. If you're looking to migrate over to this from PHPFog, you should check out this new article from PHPMaster.com with some of the differences between the two services.



Have you heard PHPFog is coming to an end? No, well - it is. That's right, in a recent announcement on their mailing list, the company has said that PHPFog will be no more by the end of January, 2013. But if you're on their platform, don't panic! The new, combined platform may be even better than what you're accustomed to with them now.


He talks about some of the things that are different including the technologies it employs, addons it provides, the differing deployment process and when teh final cut-off date is. He links to their own migration guide for most of the steps but mentions one specific change that might trip you up - the change to store connection information in the "VCAP_SERVICES" environment variable.

2012年11月26日星期一

Community News: Packagist Latest Releases for 11.26.2012

Recent releases from the Packagist:

Zumba Engineering Blog: Mocking Singleton PHP classes with PHPUnit


On the Zumba Engineering blog today Chris Taylor has a new post about mocking in PHPUnit, specifically how to handle those pesky Singleton methods lurking around your codebase.



In many of our projects, utilities and vendor classes are implemented with a singleton pattern. [...] In this post, we'll cover a nice way to inject a PHPUnit mock object for use in testing methods that utilize singleton classes.


He starts by introducing mocking and how to use mock classes in PHPUnit with a simple "sayHello" example. Adding on another layer, he creates a "SomeclassMock" class, defining its own "expects" and "cleanup" methods. This class forces the Singleton method to act more like a regular non-static method and "resets" it after each use.

Andrew Podner: Using Final to Prevent Overrides and Extension


In the latest post to his site Andrew Podner takes a quick look at something you don't see too much in PHP applications but is a familiar concept to some coming in to the language from others - using "final" to prevent overrides of the code in your classes.



In a previous post about inheritance, I showed you how to extend a class. One aspect of extending classes that wasn't fully covered was the idea of overriding a method in a class. You can override a method (function) from the base class by simply redefining the method in the child class. [...] There are times though, when you do not want a method to ever be overridden. There may even be cases where you do not want a class to be extended.


His example shows how to use this "final" keyword on a database class, protecting a method (getRecord) that could potentially break the application if changed. This would then give the developer trying to extend the class an error noting that that method cannot be overridden. One thing to note, if you're going to use "final" in your code, be sure you know what you're doing. More often than not, you probably just want something like "private" or "protected" (see this post for a bit more explanation).

2012年11月23日星期五

Site News: Popular Posts for the Week of 11.23.2012

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 11.23.2012

Recent releases from the Packagist:

PHP.net: PHP 5.4.9 and PHP 5.3.19 released!


On PHP.net site today, they've announced the latest releases in the PHP 5.3.x and 5.4.x series - PHP 5.3.19 and PHP 5.4.9:



The PHP development team announces the immediate availability of PHP 5.4.9 and PHP 5.3.19. These releases fix over 15 bugs. All users of PHP are encouraged to upgrade to PHP 5.4.9, or at least 5.3.19. For source downloads of PHP 5.4.9 and PHP 5.3.19 please visit our downloads page, Windows binaries can be found on windows.php.net/download/.


You can view a complete list of changes in this edition's Changelog (including references to both core and extension bugfixes).

thePHP.cc: Do No Enter!


In a new post to the PHP.cc site today Arne Blankerts reminds us that not all security is about writing good code and handing data correctly - it's also about the systems they run on.



What seems to be so obvious for road traffic and its rules seems to be less obvious for many web developers. They tend to slack on defining (and monitoring) what is happening at the application level as well as the infrastructure level of their application. It is not enough to run a default install of your operating system of choice, add whatever services you need, and hope for the best. Considering the amount of money as well as damage to reputation, either directly due to fraud and abuse or indirectly by time lost to recover a hacked system or software, the "let's hope for the best" approach is of arguable quality. And we are not even considering general bugs here.


He mentions configuring the server, OS and network to ensure a higher level of security, noting that no matter how much work is put into secure code, if the attacker can get to points on the system they shouldn't, your app is still vulnerable.



But how can you tell if someone is actually trying to break in? Pretty much exactly as the police does for road traffic: with speed checks and by patrolling. A properly configured firewall will show as well as inhibit any unauthorized communication within the network and all you need to do is monitor the vital signs of your infrastructure.

2012年11月22日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

Community News: Packagist Latest Releases for 11.22.2012

Recent releases from the Packagist:

Anthony Ferrara: Programming With Anthony - Paradigm Soup

Anthony Ferrara has posted about his first video in a series he's creating about programming and related topics. In this first one he talks about "Paradigm Soup".



So, for the past few days I've been talking about a secret project that I've been working on. Well, today I'm pleased to announce the project. I've been working on starting a series of YouTube videos about programming. The first of these videos is about Paradigms (Procedural, OOP, Functional). Plenty of future ones are planned, but the topics, order and even if they happen is completely up to you!


He goes through some common practices in things like OOP, functional and procedural programming as well as how they relate to each other. You can view the video in the post or you can watch it over on Youtube. If you want to keep up with the series, you can follow this playlist.

Ben Ramsey: The Era of PHP Testing


Ben Ramsey has a new post to his site where he reviews the "eras" of PHP that it's gone through in the past few years and ends up with what he calls the "Era of Testing" - the recent strong push that's being made to promote and encourage unit testing in PHP applications.



Over the past decade, the PHP community has progressed through a handful of distinct eras that have each been marked by a focus on specific best practices. This is most evident in the types of talks presented at conferences and user groups and in the articles published by php|architect magazine, PHPDeveloper.org, and the blogs of those whose feeds are distributed through Planet PHP. In thinking through this, I've come up with the following eras I think we, the PHP community, have had over the last ten years. These are in a general order, but eras overlap, and some have lasted longer than others, so there's not a distinct beginning or end to each.


He briefly covers five different areas that PHP has evolved in over the past years: the shift to OOP, web application security, framework use, coding standards/organization and the push for better testing.



With the coming of the testing era, I'm seeing a lot of maturity in our community. The code we write is getting better. We're following standards and best practices. We're implementing a lot of good design principles. [...] I think the decade since PHP 5 was released has brought us to a great place as a community. [...] With each new era, we can't forget what we've learned, though. We must continue teaching and revising these best practices as we learn more.

2012年11月21日星期三

DPCRadio: Episode #2012-16 - Travis CI - Distributed CI for the Masses


DPCRadio (recordings of the sessions at this year's Dutch PHP Conference) has posted its latest episode - a recording of Josh Kalderimis' talk Travis CI - Distributed CI for the Masses!.



Continuous Integration has typically been a practice only performed by companies who want that piece of mind for their client software, but does it need to be like this? Travis CI is a continuous integration service for the open source community. We make testing OS projects dead simple and fun. But most importantly, we help improve code quality for large projects like Doctrine2 and symfony, to smaller libraries like FOSRest. The vision behind Travis CI is to become for builds what PEAR is for distributing libraries. In this talk Josh, one of the core members of the Travis CI team, will introduce you to the vision behind Travis, the how it is implemented, and why it matters to everyone in the OS community.


You can listen to this latest episode either by using the in-page player or by downloading the mp3. You can also subscribe to this podcast.

Community News: PHP-GTK Project Moves to Github


According to this new post on the main PHP-GTK project's website, they've officially made the move over to github:



Although the main PHP-GTK site at http://gtk.php.net/ does not (yet ?) make mention of it, development of PHP-GTK is still active, but is using a more recent infrastructure, having moved to Github like many other projects.


You can find this new repository at https://github.com/php/php-gtk-src. The PHP-GTK project is an extension for the PHP programming language that implements language bindings for GTK+. It provides an object-oriented interface to GTK+ classes and functions and greatly simplifies writing client-side cross-platform GUI applications.

2012年11月20日星期二

Community News: Latest PECL Releases for 11.20.2012

Latest PECL Releases:

Community News: Packagist Latest Releases for 11.20.2012

Recent releases from the Packagist:

Volker Dusch: If it's not written in PHP it's irrelePHPant!


Volker Dusch has a new tongue-in-cheek post to his site talking about a few pieces of useful software that are not written in PHP...and why not?



Dear PHP Community, we need to have a talk about the insufferable state of your software stacks. It was recently brought to my attention that there is software out there, software we use every day!, that is NOT written in PHP. This is completely unacceptable! We are PHPeople! We're not "Web" Developers, we are the web. And we sure as hell are not some fancy "Software Developer", you can ask anyone on the internet! Seriously: If it's not PHP how will we ever be able to extend and adapt it to our needs! We are slaves of our tools!


He mentions several tools that, yes, while not written in PHP are very useful to just about any developer out there (including git, Puppet and Apache). But, more seriously:



PHP is a language that enables absolute beginners to start creating on the web using FTP and notepad! It let's us realize and validate our ideas blazingly fast and allows us to adapt our successful ideas to beautifully scale with our requirements providing and relying on solid, battle-proof tools.

Benjamin Eberlei: Composer and Azure Websites Git Deployment


In a new post to his site Benjamin Eberlei continues his look at using various platform-as-a-service (PaaS) offerings for PHP available today and talks about using Composer with Windows Azure via its post deployment hooks.



It turns out that Azure Websites - to support other platforms that require compiling - actually has an extremly robust deployment system (as far as I understood its internals). If Composer fails during this step, the website will still be served from the currently running version and you don't have to face unexpected downtime. To actually run Composer as a post-deployment tool you have to do some manual work.


This manual work comes in the form of a special ".deployment" file included in the root of your repository that defines the command to execute (a custom script). Included there at the end of the post is the PHP code you'll need to put in this custom script to get the latest version of composer and then require the phar file for use later in your application.

2012年11月19日星期一

Community News: Packagist Latest Releases for 11.19.2012

Recent releases from the Packagist:

PHP/Cloudcast: Getting Started with Stripe Webhooks


On the PHP/Cloudcast site today they've released another screencast showing you how to integrate your application with Stripe, the popular (and programmer friendly) payment gateway for your applications. This is the third part of their series.



In this, the third episode of PHP Cloud Development Casts, we go through how to integrate Stripe Webhooks in to our PHP applications. We extend the PHP Kohana application we created in episode 2 and show how simple it is to create a webhook and to receive the information and store it in a MySQL database.


Through the use of Stripe's webhooks, you can have a transaction call back to your application on a specified URL and perform further actions. In his example, he shows how to make the request, handling the "payment success" event. He includes all of the code (controller, view, etc) that you'll need to plug into Kohana to make it all work.

Community News: PHP Master Series, Volume 1 (One-Day Virtual Conference)


Cal Evans has officially announced his latest in his series of full-day virtual conferences aimed at PHP developers - the PHP Master Series, Volume 1 (from the Day Camp 4 Developers):



There is a lot of good information shared at conferences and sadly not event 1% of developers who identify themselves as PHP developers, ever get to attend one. This makes me sad. So I'm trying something new. [...] I went through the PHP conferences from the second-half of this year and picked out 6 that really stood out. This was a very difficult task; the PHP community and conferences are blessed with a bounty of great talks and speakers. The criteria I used was topics, joind.in score, and speaker. I tried to find talks that were on topics that are of interest to developers, that others liked, and that were given by speakers I know, and know do a good job.


This one-day virtual event is happening December 21st (a Friday) and is made up of six different talks from six different speakers:



  • Designing Beautiful Software - Matthew Weier O'Phinney
  • Cryptography For The Average Developer - Anthony Ferrara
  • Javascript Best Practices & BackboneJS for the PHP Developer - Ryan Weaver
  • Your code sucks, let's fix it. - Rafael Dohms
  • Building a Firehose - Ian Barber
  • From POX to HATEOAS, A Real Company's Journey Building a RESTful API - Luke Stokes


You can pick up your ticket to attend for just $50 USD as a regular attendee (or voice only for those that just want to listen in). There's also an option for an "Office Party" for $100 USD if you have more than a few folks that would like to attend.

Bradley Holt: Entity Relationships in a Document Database at ZendCon 2012 (Video & Slides)


If you weren't able to attend this year's ZendCon conference and wanted to see Bradley Holt's talk about entity relationships and document databases, you're in luck - he's posted both the video and slides to his site. Here's his summary of the session:



Unlike relational databases, document databases like CouchDB and MongoDB do not directly support entity relationships. This talk will explore patterns of modeling one-to-many and many-to-many entity relationships in a document database. These patterns include using an embedded JSON array, relating documents using identifiers, using a list of keys, and using relationship documents. This talk will explore how these entity relationship patterns equate to how entities are joined in a relational database. We'll take a look at the relevant differences between document databases and relational databases. For example, document databases do not have tables, each document can have its own schema, there is no built-in concept of relationships between documents, views/indexes are queried directly instead of being used to optimize more generalized queries, a column within a result set can contain a mix of logical data types, and there is typically no support for transactions across document boundaries.


He also includes links to two of the tools he mentions in the talk - Doctrine CouchDB and the Doctrine MongoDB ORM.

2012年11月16日星期五

Site News: Popular Posts for the Week of 11.16.2012

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 11.16.2012

Recent releases from the Packagist:

Alex Bilbie: Introducing MongoQB


Alex Bilbie has passed along a link to a project he's been working on to try to simplify access to MongoDB databases from PHP - his MongoQB library:



A few years ago I released a MongoDB library for the CodeIgniter PHP framework which has become quite popular thanks to it's likeness to CodeIgniter's query builder library. I've just spent the last week travelling and to keep myself occupied I spent some time re-architecting the library's code; removing the framework dependancy, making it Composer friendly and adding a full suite of unit tests. Check out the code on Github - https://github.com/alexbilbie/MongoQB.


The library makes it simpler to do most of the usual CRUD (Create, Read, Update, Delete) operations with your Mongo data. Example code is included in the post. This is a nice lightweight alternative to things like the Doctrine query builder.

Neal Anders: Insight into getting conference proposals accepted..


If you've considered submitting to a technology conference as a speaker but didn't really know where to start, you might check out this advice from Neal Anders based on his experiences in the PHP community.



Recently in a conversation on Twitter the topic of what a successful conference proposal - one that gets accepted - looks like, came up. I thought I would expand upon the conversation and the "3 key takeaways" advice I gave, by providing the raw submissions I entered, in this case, to PHP Tek 12, as well as some lessons learned and additional commentary.


He shares his thoughts on what kinds of things it takes to get accepted (note: one is "luck"), what some of his example proposals look like, how to deal with some of the pre-conference jitters and a few final tips on getting that "accepted" email.

2012年11月15日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

Community News: Packagist Latest Releases for 11.15.2012

Recent releases from the Packagist:

Hasin Hayder: Running Zend Framework Applications in AppFog


Hasin Hayder has a quick post to his blog today about how you can configure an AppFog instance to be able to run Zend Framework-based projects on them.



AppFog is quite a popular polyglot PaaS (Platform as a Service) provider and it comes with a generous free plan for the developers. [...] Recently, I was looking for a solution on how to host a Zend Framework based application in AppFog. The main problem was that the url must point to the /public folder inside the app and from there it is initialized. After searching for some time, I found the clue in AppFog's doumentation which is you'll have to redirect all the traffic from the parent domain to the /public/index.php file using the URL rewrite rules.


The rewrite rules are included in the post for easy cut-and-pasting. With the recently announced closing of their phpFog service (in favor of just supporting AppFog) I'm sure this tip could come in handy for a lot of developers out there.

PHPMaster.com: PHP Dependency Management with Composer


If you haven't taken a look at the Composer tool for package management in your PHP applications, you owe it to you and your development process to check it out. PHPMaster.com wants to help you out and has posted a new tutorial telling you all about the system and how to use it in your applications.



In this article I will introduce you to another great project, Composer. Maybe you've experienced the pain of working on a PHP application which uses third-party libraries and then trying to keep them and their dependencies up to date. If so, Composer can soothe your pain. Composer gets you the libraries you want at the versions you need. And if those libraries use other libraries, it can install those and manage them as well. Dependency management can be a hassle-free experience using Composer.


He includes the basics like getting it downloaded and installed (via a single-line curl command) and creating a sample "composer.json" file to pull down some libraries from the Laravel framework. He also includes a bit about making your own library a package and adding it to Packagist. For more information about Composer (and Packagist) see the project's main website.

2012年11月14日星期三

Community News: Latest Releases from PHPClasses.org

Community News: Packagist Latest Releases for 11.14.2012

Recent releases from the Packagist:

Voices of the ElePHPant Podcast: Interview with Nate Abele


The Voices of the ElePHPant podcast has published their latest interview with a PHP community member - this time it's Nate Abele of the Lithium framework project (as recorded in the



Cal's three questions talk mostly about his work on the Lithium framework



  • What started you on the road to building another framework?
  • What makes Lithium special?
  • What is your favorite piece of the framework?


You can listen to this latest episode either through the in-page player, by downloading the mp3 or subscribing to their feed.

2012年11月13日星期二

Community News: Latest PECL Releases for 11.13.2012

Latest PECL Releases:

Community News: Packagist Latest Releases for 11.13.2012

Recent releases from the Packagist:

Martin Shwalbe: Getting Started with REST and Zend Framework 2


Martin Shwalbe has a new post that wants to help you get started using the Zend Framework 2 for creating REST web services quickly and easily.



Today i want to show you how to build a rest application. This tutorials assume you have completed the Getting Started. I will be repeating lot of the steps allready explained in there. There is also a sample Album module which you can install from here.


He starts off by setting up the Album module to load via the module autoloader and sets up its controllers and views in the module configuration. He shows how set up the REST routes (via the "router" in the module config), how to set up the view strategy and how to make a first controller. There's also a bit about testing this newly setup module with PHPUnit.

Michelangelo van Dam: Learning lessons at ZendUncon


Michelangelo van Dam has shared something new he learned at the recent ZendCon conference about using fixtures with his PHPUnit testing.



In my previous post I already mentioned Sebastian Jerzy Wilczyński (@dj_sebastian_w) and his uncon session "Unit Testing for Databases using fixtures and phpunit". It made me wonder how much difference it would make if you use fixtures instead of testing database interactions using predefined sets of data. Since I work a lot with Zend Framework I was looking at how I could use fixtures and mock objects to follow Sebastian's guidelines. So I gave it a try. This is what I came up with.


He illustrates with some example code - a set of database data (the fixtures) and sample tests that use the Zend Framework's mapper and table gateway functionality to work with the tables. His test then mocks out the DbTable class for the "Order" object and forces a return of the database fixture data.

2012年11月12日星期一

Community News: Latest PEAR Releases for 11.12.2012

Latest PEAR Releases:

Community News: Packagist Latest Releases for 11.12.2012

Recent releases from the Packagist:

7PHP.com: Interview with Rob Allen: Author of Zend Framework in Action


On 7PHP.com today they've posted the latest in their interview series with people from all across the PHP community. In this most recent post, they talk with Rob Allen, author of the "Zend Framework in Action" book and well known speaker and Zend Framework contributor.



In this edition I talked with Rob Allen who is the main author of the famous PHP book "Zend Framework in Action". He is very passionate about the whole Zend stuffs: he's a contributor to the Zend_Config component in Zend Framework 1, he's a member of the Zend Framework Education Advisory Board, he keeps on with his contributions with the new Zend Framework 2 and he rambles a lot about QUALITY Zend Framework tutorials on his blog. Rob is fond of writing; his latest PHP-Advent article is "Better Than the Rest" and is also a regular conference speaker, speaking at the likes of ZendCon, PHP North West, PHP|Tek and a whole lots of places.

In the interview Rob answers questions about:



  • How he got started with PHP
  • His advice to beginning PHP developers and ones looking to improve themselves
  • Who he works (IDE, debugging, testing)
  • Some recommended resources to learning and keeping up to date
  • and some of his thoughts about conferences

Adam Culp: Clean Development Series: Part 4, Rewrite dilemma


Adam Culp has published the fourth part of his "Clean Code" series to his site today (see more about parts 1-3 here) with a look at the "Rewrite Dilema" - whether it's more productive to just rewrite or to try to refactor.



Unfortunately the first reaction to a poorly written application is usually a resounding "rewrite". Developers feel like a weight is lifted from their shoulders, as the manager hears a distant "cha-ching" sounds of money slipping away. [...] In the managers mind a rewrite means it must all be duplicated, and that's not far from the truth when we consider the salaries of an entire development team for the time it will take to rewrite the entire application.


Adam talks about some of his experience in the past with challenging applications and a typical scenario where one group in the company splits off and creates the new version while another maintains the old. He suggests, however, that refactoring may be a more viable option. While it might not seem easier to handle overall, the end results could lead to a more stable system and could take less time than starting from scratch.

2012年11月9日星期五

Site News: Popular Posts for the Week of 11.09.2012

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 11.09.2012

Recent releases from the Packagist:

Oscar Merida: Smelly PHP code


Oscar Merida has written up a sort of continuation to this series from Adam Culp about clean code, one that shares more tips on knowing when to refctor.



Adam Culp posted the 3rd article in his Clean Development Series this week, Dirty Code (how to spot/smell it). When you read it, you should keep in mind that he is pointing out practices which correlate with poorly written code not prescribing a list of things to avoid. It's a good list of things to look for and engendered quite a discussion in our internal Musketeers IRC.


His suggestions include things like "Comments are valuable", "Using switch statements" and a few other smaller ones involving error suppression, globals and prepared statements in database usage.

2012年11月8日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

Community News: Packagist Latest Releases for 11.08.2012

Recent releases from the Packagist:

KnpLabs Blog: Composer Level2: 5 more things like Class Maps, Forking, & Scripts


On the KnpLabs blog there's a new post from Ryan Weaver sharing some cool things you can do with Composer you might not have known about when managing your application's dependencies.



For those of you that are comfortable with Composer, I wanted to talk about a few lesser-known, but really fantastic features. These are inspired by real questions I've heard while running around the country doing my one-man composer-and-dancing show (i.e. conference talks).


He shares four of them with a fifth that's more of an "upcoming feature" than a current one:



  • Autoloading & Performance: "I thought class maps were the fastest?"
  • Running Post-Deploy Scripts
  • "What if I need to fork a library?"
  • Can I host private packages on Packagist?
  • What about signing the authenticity of Packages?


That last one about package signing is still on the known issues list and is under discussion, but no doubt that future versions of the tool will support it.

PHPMaster.com: The Open/Closed Principle


On PHPMaster.com there's a new post continuing their look at the SOLID development methodologies with the "O" in the acronym - the Open/Closed Principle:



I have to admit the first time I peeked at the academic definition of the Open/Closed Principle, its predicate was surprisingly clear to me. Leaving all of the technical jargon out of the picture, of course, its dictate was pretty much the mantra that we've heard so many times before: "Don't hack the core". Well, admittedly there's a pinch of ambiguity since there are at least two common approaches to keeping the "core" neatly preserved while extending its functionality. The first one (and why I used deliberately the term "extending") would be appealing to Inheritance. [...] The second approach is Composition.


He illustrates the effective application of the principle with the creation of a HTML rendering class. The first version is non-polymorphic and just renders the example DIV and P elements that are passed into it. He changes this up by shifting these element classes into something extending an AbstractHtmlElement class (sharing an interface between them) and updating the renderer to handle these correctly.

2012年11月7日星期三

Community News: Latest Releases from PHPClasses.org

Community News: Packagist Latest Releases for 11.07.2012

Recent releases from the Packagist:

Zumba Engineering Blog: Some CakePHP optimizations


For those out there using the CakePHP framework to create your applications, you might be interested in these quick tips from Juan Basso on the Zumba Engineering Blog for both the architecture and actual code to optimize the performance of the app.



Our site and system has a lot of throughput and it make us use more instances and try to reduce the load in every part. It makes the company happy (save money) and also make the customer happy (faster load). On this article I will go over few things in terms of architecture and some code changes/strategies that could make your application faster as well.

Some of the recommendations include:



  • Installing the APC/opcode caching to help save execution time
  • Avoiding as many network requests as possible
  • Use local file/data caching
  • Using the "requestAction" inside controllers with its built-in caching