2012年6月29日星期五

Joshua Thijssen's Blog: Using vagrant and puppet to setup your symfony2 environment


In his most recent post Joshua Theijssen shows you how to set up a complete Symfony2 environment, automated with the help of Puppet and Vagrant.



Together with other tools, setting up a complete development environment with just a single command is not only reality, but it's becoming for a lot of developers a daily practice. But even for open source projects like joind.in and protalk.me are seeing the benefits of having "development environment on the fly". New contributors don't have to spend a lot of time setting up their environment, but it's automatically generated: the code setup, the database server together with a filled set of data, any additional components like varnish, memcache, reddis etc. This blog post gives an overview on how to setup a symfony2 project with the help of vagrant and puppet.


He provides you with some examples in the form of a Vagrantfile that sets up a 64 bit CentOS instance and configures the server with a few settings and points it to a Puppet configuration. He includes a basic set of Puppet configuration examples and shows how to use it to install various packages, set up MySQL, load phpMyAdmin, configure PHP and, finally, bootstrap the Symfony2 by seeding a Doctrine schema.

2012年6月28日星期四

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

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

Cal Evans' Blog: Setting Up a (FREE) WordPress Development Site


In this new post to his blog, Cal Evans shows developers (and non-developers) how they can set up a free WordPress blog with the help of the phpcloud.com and phpfog.com hosted services.



Everyone however, experiments. Whether it's a new theme or a new plugin, you really, really need someplace to test things. one of the worst thing you can do is what I do with this blog, just install things and play with them in production. [...] There is a solution though, actually, I'll present you with two. One for PHP developers who know what they are doing and want control, and one for regular bloggers who just want someplace to test plugins and themes before pushing them live. In both cases though, the services are free.


He gives a brief introduction to setting up and configuring each of the services - one that lets you import your own version and the other that lets you select to automagically setup a WordPress instance.

MaltBlue.com: 4 Keys to a Great Software Development Methodology


On the MaltBlue.com blog Matt has posted four different keys he sees to making a good software development environment and make for happier developers (and managers).



A lot of the time when we're developing applications they're likely to be based around customizing or extending an existing application, such as WordPress, Joomla, Oxid eSales et al. In these cases, there's a clear set of rules and guidelines to work with. [...] But what about when we're building our own applications, bespoke ones, from scratch. [...] What do we do then? How do we set up a great software development methodology or set of processes to ensure that we develop cleanly, clearly and efficiently? In today's post, I'm going to go through 4 areas which can serve as a solid and reliable basis for us to do just this.

The four key elements he sees are:



  • Organized Development Environment
  • Organized Deployment Approach
  • Organized Testing Approach
  • Have a Professional Bug/Issues Database


For each of these elements, he describes some of the methods and tools that can help make them possible.

PHPMaster.com: Managing Class Dependencies: Dependency Injection, Service Locators & Factories, Pt 2


PHPMaster.com has posted the second part of Alejandro Gervasio's series looking at dependency injection, service locators and factories. In this new part of the series, he picks back up with his look at these patterns and how they can reduce your dependencies on things like "new" even more.



While it's fair to admit that factories do have a neat niche in a number of special use cases, I'm not so merciless as to condemn Service Locators and plain Dependency Injection to an unfair exile. In this final part we'll take a closer look at the implementation of these popular patterns so that you can pick up the one that best suits the need at hand.


He talks some about "class collaborators" as used in service locators and using it in his FileStorage example to find and use pre-created objects. He compares this method with a more simple dependency injection approach, noting that not only is it simpler to maintain but also can cause less overhead required for the DIC.

2012年6月27日星期三

Zend: Results from "Zend Developer Pulse" 2012 Survey Posted


Zend has published the results of their "Developer Pulse" survey for 2012 - the product of a survey of over three thousand developers across the PHP community.



The summer 2012 edition of the Zend Developer Pulse™ survey shows that PHP is gaining prominence as a cloud application development language of choice. The combination of speed and ease of use enables developers to build and deploy PHP-based cloud applications quickly: more than half the developers surveyed indicated that the apps they are developing today are destined to be deployed in cloud environments.


You can view the full results of the report in this PDF which touches on topics like:



  • Developing in the cloud
  • Working with APIs
  • Versions of PHP developers are using
  • Tools & best practices

2012年6月26日星期二

Community News: Latest PECL Releases for 06.26.2012

Latest PECL Releases:

PHPMaster.com: PHP DOM: Using XPath


On PHPMaster.com today there's a new tutorial showing you how to use the XPath functionality that's built into PHP's DOM functionality to query your XML.



In a recent article I discussed PHP's implementation of the DOM and introduced various functions to pull data from and manipulate an XML structure. I also briefly mentioned XPath, but didn't have much space to discuss it. In this article, we'll look closer at XPath, how it functions, and how it is implemented in PHP. You'll find that XPath can greatly reduce the amount of code you have to write to query and filter XML data, and will often yield better performance as well.


They start with some basic XPath queries to find a simple path and locating the record for a specific book. There's also an example of using XPath versus the "find" functions in the DOM functionality (like getElementsByTagName). There's also a bit close to the end about using functions in XPath and how you can pull back in PHP functionality and use native PHP functions in your XPath queries.

Brian Moon's Blog: Stop comparing stuff you don't understand


In his latest post Brian Moon responds to another "PHP versus..." article from this site comparing it to Node.js and how it's less of a valid comparison and more of an "apples to oranges" comparison.



I normally don't do this. When I see someone write a blog post I don't agree with, I often just dismiss it and go on. But, this particular one caught my attention. It was titled PHP vs Node.js: Yet Another Versus.


He points out some of the problems with some of the arguments, specifically with some of the points made about Gearman, memcache, the PHP.net site and the creation of daemons in PHP.



Listen, I write code in PHP and JavaScript all day. I also use some Ruby, Lua and even dabble in C. I am not a language snob. Use what works for you. I do however take exception when people write about things they clearly have no idea about.

Stefan Koopmanschap's Blog: Dutch PHP TestFest big success


There's a quick post over on Stefan Koopmanschap's blog about the recently wrapped Dutch PHP TestFest that happened in conjunction with the PFZ.nl and AmsterdamPHP user groups.



The PHP TestFest that Dutch usergroups PFZ.nl and AmsterdamPHP organized last saturday was a huge success. About 15 people made their way to the office of WEBclusive to collaborate with three key figures from the PHP-world, who travelled to Amsterdam to be a mentor, to write tests for PHP.


He mentions some of the work that was done including updates to tests on the Gearman extension, the MongoDB extension and others worked on the tests for PHP's core. Fifty-four new tests were written during the event and testers even continued writing after they left - win all around!

Voices of the ElePHPant Podcast: It's the booze talking, episode 03: APIs


The Voices of the ElePHPant podcast has released their latest episode in the "It's the Booze Talking" series. In this new episode (Ep. #3) the group talks about APIs. The host this time is Keith Casey.



They talk about common problems and solutions around their company's APIs (and others they've dealt with). They cover one of the most important part of any API's structure, security, and different methods of handling it (HMAC, Oauth, etc).



Others involved in the discussion are Jason Austin, Brandon West, Rob Richards and Luke Stokes. You can listen to this latest episode either through the in-page player, by downloading the mp3 or by subscribing to their feed.

2012年6月25日星期一

Chris Roane's Blog: Options for Building a Website from a Developers Perspective


Chris Roane has a new post to his blog outlining a few different options web developers today have for creating new websites or applications - static, custom, framework-based or CMS.



Over the years I've built many different types of websites. These range from being a few pages, to being very customized with advanced features. I've learned there is no clear definition in the best way to create a website. But I do think there are advantages and disadvantages to pursuing different methods. This article takes an analytical look at each option. Let's take a closer look at the different approaches in building a website.


He includes a brief summary talking about each method and mentions things like benefits and downfalls of the approach and what can be involved in their development.

Jurian Suilman's Blog: Use 3rd party modules in Zend Framework 2


Jurian Sluiman has posted this guide to using other (3rd party) modules in your Zend Framework 2 applications with a few simple steps (code examples included).



The release of the first RC (release candidate) of Zend Framework 2 is getting close. One last beta (beta5) and then the RC will be announced! With the current pace of modules spawning on GitHub, I think it is a good idea to give some insights in how you can use 3rd party modules. In this blog post I will focus on MVC modules: modules with routes pointing to controllers and view scripts for rendering. Because using a 3rd party MVC module does not mean you are enforced to follow their routing scheme, use their view scripts or use the predefined forms, I will explain how you can modify those options to your needs.


He covers the three steps needed for integration - adding a new route to handle the requests to the module, adding a view script to handle its output and working with a Form instance to add a bit more handling.

Symfony Blog: Symfony Live San Francisco 2012: The Schedule


The Symfony Blog has posted about the schedule for this year's Symfony Live San Francisco being posted:



The schedule for the Symfony Live conference in San Franscico has just been published. For the first time in the US, Symfony developers will be able to take the Symfony certification exam on September 29th. You can already register.


They're also still looking for sponsors for the event if you'd like to help out. You can also go purchase a ticket if you know you'd like to attend this year's event (September 26th through 29th in San Francisco, CA).

2012年6月22日星期五

Site News: Popular Posts for the Week of 06.22.2012

Popular posts from PHPDeveloper.org for the past week:

Robert Basic's Blog: Using the new autoloaders from Zend Framework 1.12


Robert Basic has a new post today about the autoloaders in Zend Framework 1.12 and how to use them to create a classmap for use in your application.



The latest, and last, release of the Zend Framework 1.x series is just around the corner as ZF 1.12.0RC1 was announced this week. As I still have projects running ZF1 I thought about giving the most interesting new feature (for me) a spin - the new autoloaders which are backported from ZF2. I decided using the classmap autoloader as the main autoloader, and the good ol' standard autoloader as the fallback autoloader.


He includes the changes to the Front Controller (index.php) to have it know about these new autoloaders and has a command that will go through your code any pull out any require_once statements out and let the autoloader handle it instead.

PHP-Tip-a-Day: PHP Tutorial: King Floyd and the Seventeen Princes - A Tale of the Observer Pattern


On the PHP-Tip-a-Day site today there's an new "fable" posted in the Design Pattern Fables series. This time it's about the Observer pattern (and kings and princes).



The first place I recall encountering the observer pattern was not in PHP, but in JavaScript. If you've ever set a listener to fire when an event happened, you've used the observer pattern. Functions or methods are registered with an object so that when it experiences a specific event, it "notifies" the registered functions or methods by calling them.


His story tells about a royal family, a pregnancy and magic mirrors that allows for instant communication between the family and outlying locations. He relates it to the objects and "watchers" that make up the Observer pattern and gives a brief code example (in Javascript) of a HTML button and a jQuery event observer that fires when it's clicked.

Mayflower Blog: Software Architecture Decisions - How to do it Wrong the Hard & Easy Way


On the MayFlower blog today there's a new post looking at two ways to do software architecture (the easy way and hard way) and some of the traditional practices behind its development.



When it comes to software architecture, stuff gets funny. First we learn everything about it at university. We learn to use it as a part of our main project plan. We learn how to do risk evaluation. [...] Since we didn't have a lot of experience with software back then, the resulting architecture is a badly done, but well documented. This style of software architecture is called "Enterprise Architecture" and usually done by consultants.


They talk about delivering software versus delivering documentation and list some of the actual common reasons software architecture turns out how it does including: "I read about it in a blog", "It worked for me once" and the idea of the "Golden Hammer" of standardized structures.

2012年6月21日星期四

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

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

PHPMaster.com: An Introduction to Dependency Injection, Service Locators & Factories (Part 1)


On PHPMaster.com they've posted the first part of a series looking at something that's become a hot topic in the PHP community over the last months - dependency management and service locators.




From a programmer's perspective, the process of designing easily consumable APIs while still keeping a decent level of decoupling between the involved classes is always a tricky trade-off, as the more expressive the dependencies are, the harder the work is that needs to be done behind the scenes for wiring up the collaborators in their proper sequence.



In this two-part series I'll be doing a quick roundup of some of the most common methodologies that can be employed for managing class dependencies in modern application development, ranging from using service locators and injectable factories, to sinking your teeth into plain vanilla Dependency Injection, and even implementing a naive Dependency Injection Container.




He talks about the "plague of the 'new' operators" and how, through the use of an injected factory object, they could be easily replaced. Code samples are included showing the initial state and the end result, refactored to inject his "SerializerFactoryInterface" into the "FileStorage" class.

Michael Nitschinger's Blog: Using Couchbase as a flexible session store


Michael Nitschinger has a new post to his site today showing how to implement Couchbase as a storage mechanism for your session information (including some handy extra features).



What do I mean by flexible? Well, the combination of a highly scalable key-value store and the possibility to query your data through views allows you to gain unique insight inside your data in near realtime. [...] Let's look at some obstacles that we as application developers face and then see how we may solve them through Couchbase and its functionality.


He talks about some of the options to track user sessions (both on the server and client side) including PHP's sessions, HTML5 data storage and memcache. He covers some of the most basic session tracking needs and shows how to use the CouchBase extension to work with and setting some key/value combinations for user sessions. He shows how to query these data structures (JSON data) and filter to find only the records needed

DZone.com: Record and replay for testing of legacy PHP applications


In this new post to DZone.com Giorgio Sironi looks at a method for "recording" the request and response information for an application that might be lacking in documentation using PHP's output buffering.



So you've got this big ball of code. You don't even know how to call all of these scripts, but the code is in production and works just fine (until you have to change even a single line). How to define some characterization tests that describe how the .php scripts work now? [...] If tests do not exist, we do not know if they expect GET or POST requests, which parameters they contain, and above all what their response should be in correct and error cases. Even if all the links and calling code are under your control, it may be faster to go for the recording approach. If other applications and machines call your .php files, it is your only choice.


He suggests using ob_start and the output buffering methods to handle the recording as it lets us define a callback (or in his case, a recording object). He includes an abstract version of it, showing how to implement a "Tape" class and a "record" method to handle the data and push it into a log or some other recording mechanism.

Grzegorz Godlewski's Blog: Automating software development and deployment


Grzegorz Godlewski has a new post to his blog that looks at some of the concepts and practices around automated software deployment and development (specifically with Phing).



Phing is a tool designed for automated project building based on Apache Ant distributed as a PEAR extension. It provides the user with the possibility of building the project / application in the same manner as make does with its Makefiles, making complex process execution (which is commonly human error prone) much easier.


He walks you through the steps for getting Phing set up, the directory structure you'll need for your project and a sample build and property files as well as an example of the output from the build execution. He talks about filters, execution control, extensibility and looks at some of the things that he suggests automating.

2012年6月20日星期三

Community News: Latest Releases from PHPClasses.org

NetTuts.com: Building Web Applications from Scratch with Laravel


On the NetTuts.com site there's a new tutorial introducing you to one of the relatively new players to the PHP framework scene - Laravel. In this article you'll see how to set up and create a basic Laravel app - a simple social app for sharing photos.



In this Nettuts+ mini-series, we'll build a web application from scratch, while diving into a great new PHP framework that's rapidly picking up steam, called Laravel - a simple and elegant PHP 5.3 framework. First up, we'll learn more about Laravel, and why it's such a great choice for your next PHP-based web application.


They briefly introduce the framework and talk about some of the things that it offers for the PHP 5.3 users out there (including the use of packages called Bundles, the built-in ORM, migration and Redis support). They start you off on the road to building the sample application with instructions on downloading, configuring and creating the first controllers, templated views (with Blade) and a bit on asset management.

Mike Purcell's Blog: CentOS - PHP - Install Memcached (with a d) Stack


In this new post to his blog Mike Purcell gives you the full instructions to getting a CentoOS 6 system up and running with Memcached and PHP.



Recently I started retro-fitting the MeLikeDrinks.com drink website to cache frequently used data to improve performance, as such I wrote a light, custom cache API which sits on top of PHP's Memcached API. [...] If you opt to use PHP Memcache, and because this article assumes you are using CentOS, you can simply have YUM install the entire stack for your via `yum install php-memcache`.


He describes some of the differences between the two memcache APIs available to PHP developers (memcache and memcached) and includes the instructions to get both versions installed. "Memecache" is as easy as installing the package, while "Memcached" takes a bit more work - installing dependencies, configuring and compiling a few things specific to your system.

Henry Hayes' Blog: Zend Framework UserAgent Browscap Implementation


Henry Hayes has a recent post to his blog looking at a the change for the user agent support for the browser detection functionality in the Zend Framework.



Recently it has come to light that Zend Framework are dropping support for the WurflApi Features Adapter in the Zend_Http_UserAgent component. This is due to licensing issues. As of version 1.12 Zend_Http_UserAgent_Mobile constant DEFAULT_FEATURES_ADAPTER_CLASSNAME now specifies that Zend_Http_UserAgent_Features_Adapter_Browscap is now the default mobile adapter.


He shows you how to get the browscap support set up and configured for your PHP installation and what needs to be done to a pre-1.12 ZF release application (using this library) and in a post-1.12 application (almost nothing).

Codeception Blog: Test WebServices With Codeception


On the Codeception blog (an up and coming PHP-based testing tool) there's a new post showing how to use the tool to test your web services for either a SOAP or REST-based service.



Codeception testing framework got significant improvements during last week. The first and the major one is that you don't even need PEAR and Composer to execute tests. Only one file codecept.phar required. This might save your time and mind of your testers.


They've recently added modules for SOAP and REST support, making it easier to define your tests in a more fluid fashion. Included in the post are two examples, one REST and one SOAP. You can find more information about these new testing features over in the tool's documentation.

2012年6月19日星期二

Community News: Latest PECL Releases for 06.19.2012

Latest PECL Releases:

NetTuts.com: Creating a Flat-File Blog Engine Using Slim


On the NetTus.com site today there's a new tutorial showing how to use the Slim microframework to create a flat-file blog system as a stand alone PHP application.



In this article, we will learn how to create a flat file blog engine in PHP using the Slim framework. If you don't understand the jargon, don't worry. We're simply going to create a spartan blogging application, which utilizes text files instead of a database to store data. If you're a beginner, fret not! We will start with the basics of using Slim.


He introduces the Slim framework with a simple route handling to render a basic PHP page (an "About" page), setting variables to output to the template, setting up dynamic routes and creating the setup for the blogging engine (viewing articles, archives and a listing page).

PHPMaster.com: The 8 Fallacies of Distributed Computing for PHP Developers


If you're a PHP developer and are working on distributed applications (or might be in the future), you should probably read through this new article on PHPMaster.com with 8 common fallacies about these applications and their needs.



These fallacies directly relate to us as PHP developers since we build distributed applications each and every day. We build mashups, applications that interact with SOAP and REST services, authenticate users via Facebook, Google, or Twitter APIs, retrieve information from remote databases and caching services, etc. Make no mistake, we're building distributed computer applications. Given that we are building distributed applications, it's important that we understand the eight fallacies and how they affect us.

Among the list of their fallacies are things like:



  • The Network is Reliable
  • Bandwidth is Infinite
  • The Network is Secure
  • There is One Administrator


Check out the full article for the rest of them and summaries of each.

PHPBuilder.com: My Automated PHP Scripts for Creating FTP Connections to a Remote Server


PHPBuilder.com has posted a new tutorial about creating automated FTP scripts to pull down information from a remote server (using FTP streams).



In 2007 I began working on a website project for an investment company in my hometown of Cleveland, Ohio USA. The purpose of this website was to automatically download financial data of traded securities from two (2) remote Web servers. [...] Both of these PHP scripts were set up on the Web server's "crontab manager" to automatically run at a set time each business day.


Code is included showing how to connect to the remote service (via curl) with a "ftp" stream-based URL as the location. Also included is an example using a fopen call to the URL and inserting the resulting data into their tracking tables. The other script pulls the data out and adds a new record to a transactions table for the current day.

Voices of the ElePHPant Podcast: Interview with Lonnie Brown


The Voices of the ElePHPant podcast has posted its latest episode, an interview with Lonnie Brown, a recruiter that's known within the PHP community.


Cal talks to Lonnie about:



  • His first impressions of the PHP community
  • What the current PHP job market looks like
  • His thoughts on why some companies "get" telecommuting


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

2012年6月18日星期一

Community News: Latest PEAR Releases for 06.18.2012

Latest PEAR Releases:

PHPMaster.com: Web Routing in PHP with Aura.Router


On PHPMaster.com today there's a new tutorial showing how to route your web requests with the Aura.Router component from the AuraPHP component framework.



Everyone is interested in SEO-friendly, REST-style URLs. Apache can do URL routing via mod_rewrite rules, but it's hard and error prone. Why not use PHP itself to handle routing instead? Aura is a independent collection of libraries for PHP 5.4 brought to you by Paul M Jones. Here we are going to introduce you Aura.Router. Aura.Router is a simple and easy web routing library for PHP. In this article you will learn how to create routes which are SEO-friendly, REST-style URLs with the help of PHP.


He walks you through the download and install of the Aura.Router component (separate from the framework) and how to set up the mod_rewrite rules to work with it and a front controller. He includes some code for a basic usage, showing the mapping of a default route and more complex routes with named parameters. He also shows how to use the "match" method to find the route that was matched and how to dispatch/hand off the routing to a controller.

Design Aeon: Check Dead Links From Database Using PHP CURL


On DesignAeon.com there's a recent tutorial posted showing you how to extract URLs from your database and determine which ones are "dead" automatically with the help of cURL.



Checking Deadlinks From the database manually is a Headache ,So why not use a script which return the http status of the particular link and tell us if the link is dead or not.So how do we check the dead links from the database ? How do we programatically check whether the link is dead or not ? To check broken or dead links from Database we will use curl .


Included in the post is a sample script that extracts the URLs from a field in the database (you'd need some extra smarts if you're pulling it from content) and running it though a "checklink" function. If the call to curl_getinfo returns false, the link is marked dead.

Gonzalo Ayuso's Blog: Building a simple SQL wrapper with PHP. Part 2.


Gonzalo Ayuso has followed up his previous post about creating a simple SQL wrapper with PDO in PHP with this new post, a "part two" looking at improving it a bit with a new class to represent the tables.



In one of our last post we built a simple SQL wrapper with PHP. Now we are going to improve it a little bit. We area going to use a class Table instead of the table name. Why? Simple. We want to create triggers. OK we can create triggers directly in the database but sometimes our triggers need to perform operations outside the database, such as call a REST webservice, filesystem's logs or things like that.


He includes the updated code with the new "Table" class with methods that let you set up pre- and post-action hooks on each of the types (insert, delete, update) along with the rest of the library, there ready for the copy & pasting.

2012年6月15日星期五

Site News: Popular Posts for the Week of 06.15.2012

Popular posts from PHPDeveloper.org for the past week:

Nikita Popov's Blog: The true power of regular expressions


Nikita Popov has a new (language agnostic) post to his blog today about one of the most powerful things you can use in your development - something that a lot of developers don't understand the true power of - regular expressions.



As someone who frequents the PHP tag on StackOverflow I pretty often see questions about how to parse some particular aspect of HTML using regular expressions. A common reply to such a question is: "You cannot parse HTML with regular expressions, because HTML isn't regular. Use an XML parser instead." This statement - in the context of the question - is somewhere between very misleading and outright wrong. What I'll try to demonstrate in this article is how powerful modern regular expressions really are.


He starts with the basics, defining the "regular" part of "regular expression" (hint: it has to do with predictability) and the grammar of the expressions. He talks about the Chomsky hierarchy and how it relates to the "regular" as well as a more complex mapping of expression to language rules. He talks about matching context-free and context-sensitive languages and unrestricted grammars as well.

Reddit.com: Where can I find a free place to edit PHP code and see the results?


In this recent post to Reddit.com, the question is asked "Where can I find a free place to edit PHP code and see the results?"



Hey everyone,
Recently I was tasked with coming up with some code for an possible job opportunity. I'm wondering if anyone could point me to a place where I can easily write and edit PHP code and see the actual program run.

Suggestions from the comments include:


Oscar Merida's Blog: Using bcrypt to store passwords

Oscar Merida has a recent post to his blog about using the bcrypt functionality to more securely store the password information for your application's users.




The linkedin password breach highlighted once again the risks associated with storing user passwords. I hope you are not still storing passwords in the clear and are using a one-way salted hash before storing them. But, the algorithm you choose to use is also important. [...] The choice, at the moment, seems to come down to SHA512 versus Bcrypt encryption.



[...] I wanted to switch one of my personal apps to use bcrypt, which on php means using Blowfish encryption via the crypt() function. There's no shortage of classes and examples for using bcrypts to hash a string. But I didn't find anything that outlined how to setup a database table to store usernames and passwords, salt and store passwords, and then verify a login request.




He shows you how to set up a simple "users" table and the code for a "save_user" method that takes in the username/password and generates a salt and calls crypt on it with the Blowfish prefix on the string ($2a$). His login check function ("validate_user") then takes the user's input, does the same hashing and checks the result.

/Dev/Hell Podcast: Episode 14: The PHP Guy Is Sulking


The latest episode of the /Dev/Hell Podcast has been posted - Episode #14 (or "The PHP Guy is Sulking"):



This week we're joined by Justin Searls, JavaScript developer and JS testing EXPERT. We talk lots about building and testing "fat" browser apps, particularly about best practices and different testing approaches. After a while Chris felt bad and told us to shut up.


Lots of topics are touched on in this episode including:




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

2012年6月14日星期四

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

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

PHPMaster.com: Decoupling Interfaces from Implementation - Using Separated Interfaces


On PHPMaster.com today there's a new tutorial looking at using separated interfaces in your OOP applications, a design pattern that emphasized decoupled components.



Considering that the concept may sound rather tangled and twisted at first, this shifting of protocols between components lives and breaths under the umbrella of a basic design pattern known as Separated Interface, which at least to some extent, goes hand in hand with the commandments of the Dependency Inversion Principle. Moreover, because of the pattern's easy-going nature, it's feasible to implement it in PHP without much fuss.


He shows how to create a basic model (with getters and setters) and extends this into functionality to handle "Post" and "Comment" data types. The key to it all is that the "Comments" model instance is injected into the "Post" model on its creation, making it a self-contained, but still modular, object for handling all elements of a post in one place.

PHP.net: PHP 5.4.4 and PHP 5.3.14 released!


The PHP project has just released the latest versions in the PHP 5.4.x and 5.3.x series - PHP 5.4.4 & 5.3.14:



The PHP development team would like to announce the immediate availability of PHP 5.4.4 and PHP 5.3.14. All users of PHP are encouraged to upgrade to PHP 5.4.4 or PHP 5.3.14. The release fixes multiple security issues: A weakness in the DES implementation of crypt and a heap overflow issue in the phar extension. PHP 5.4.4 and PHP 5.3.14 fixes over 30 bugs. Please note that the use of php://fd streams is now restricted to the CLI SAPI.


As always, you can download this latest release from either the downloads page (source) or from the Windows site (binaries). See the Changelog for the full list of updates.

NetTuts.com: So You Want to Accept Credit Cards Online?


On NetTuts.com they're posted a new tutorial about using the Stripe service to accept credit cards on your site. Thanks to some handy libraries they provide, integration is a relatively simple process.



Until recently, accepting credit cards on a website was expensive and complicated. But that was before Stripe: a radically different and insanely awesome credit card processing company. Today, I'll show you how to start accepting cards in 30 minutes or less - without spending a dime.

They step you through the whole process you'll need to get the full flow set up:



  • Install an SSL Certificate (on your server)
  • Create an Account
  • Create Your Payment Form
  • Collect The Form Values
  • Request a Token
  • Create a Server-Side Script


Screenshots of the Stripe interface, HTML, Javascript and PHP code are all included - everything you need to make the simple card handling work. One of the keys to how Stripe deals with credit cards is that you provide it the card info, it gives you a token. Your app uses this to work with the card instead of storing the card information in your database (also making it more secure).

Lorna Mitchell's Blog: Proof that PHP 5.4 is Twice as Fast as PHP 5.3


In this quick post to her blog, Lorna Mitchell shares an interesting bit of benchmarking she did between PHP versions 5.3 and 5.4, finding 5.4 twice as fast as it's previous version sibling.



So recently I was working on some benchmarks for different versions of PHP, because I heard that PHP 5.4 is "faster" and since I'm a data geek I want to know how much faster! Now, PHP 5.4 is, in general, faster than PHP 5.3 but not twice as fast* unless you pick a use case which has been particularly optimised. My first attempt at benchmarking the two versions produced this. This was a surprise to me; was PHP 5.4 really so much faster??


Her benchmark was a pretty simple one - looping and creating a new object, evaluating the timing of how long it took to execute. A commentor also points to some more official benchmarks that were done and posted to the php.internals mailing list.

2012年6月13日星期三

Community News: Latest Releases from PHPClasses.org

MongoDB Blog: MongoDB for the PHP Mind, Part 1


On the MongoDB blog there's a new post starting off a series called "MongoDB for the PHP Mind", a look at using this popular NoSQL database from PHP. In this first post of the series, Mitch Pirtle covers things from a post-install and configure perspective.



We have covered a lot on the blog about MongoDB features, as well as many ways to utilize MongoDB from different languages. This is the first in a series of posts from the perspective of a PHP developer; and covers the gamut from getting started to advanced concepts.


He links to some guides for getting the database and the PHP extension installed and starts in to define some common terminology. He shows how to create queries to look for certain terms across multiple data points and how to port those over to the PHP side using the extension's features.

PHP-Tip-a-Day: PHP Tutorial: The Legend of the Singleton


Following his recent allegory about the Factory pattern (as described in story form) Greg Bulmash has posted the Legend of the Singleton to help with your understanding this pattern.



The Singleton pattern provides an interface to let your application always pull out the same object (or make a new one if it needs to).



His legend talks about kings, mythological data sources and the overloading of multiple "hoses" (connections) to it. Also included is a code example showing a simple database class that includes a "getInstance" method acting as the Singleton to return either a new or the (same) current instance.

WebSpeaks.in: Extract the Content of Zip file Using PHP


On the WebSpeaks.in site, there's a recent tutorial posted showing how you can extract the contents of a zip file from inside a PHP application.



Sometimes you may want the users on your site to upload the zip file and then check what are the contents of that zip file. In this article I will tell you how to extract the contents of the zip file. I temporarily extract the zip files to a directory and then delete it afterwards. You can chose to keep the extracted content if you want.


The tutorial walks you through the code, showing you how to use their "ZipArchive" class to grab the file, extract the contents and display a list of the "child files" inside it. You can see a live demo of it in action or just download the source and dive right in.

2012年6月12日星期二

Community News: Latest PECL Releases for 06.12.2012

Latest PECL Releases:

Refulz.com: Special characters in Regular Expressions - Part 1


On the Refulz.com site they've posted the first part of a series about the basics of using special characters regular expressions (both in PHP and outside of it).



With this post, we continue to explore the Regular expressions. The first post of the Learning Regular Expression series introduced Regular Expressions. The first post covers the regular expression delimiters and the "i" pattern modifier. In the language of regular expression, there is a special meaning of certain characters.


In this article they show the use of characters like the caret, asterisk, dot and dollar symbol to modify your expressions to handle special cases, matching for more than one character and the start and end of strings.

PHP-Tip-a-Day: PHP Tutorial: The Allegory of The Factory Pattern


On the PHP-Tip-a-Day site there's a new post from Greg Bulmash with an allegory about the Factory pattern (design pattern) to relate it to something a bit more practical and introduce some of its core concepts.



If you've read the About This Site page, you'll know that instead of pursuing my passion for computers, I got sidetracked into the arts in college. So when it came time for me to learn and explain the Factory Pattern, I thought it might be fun to express it as an allegory...


His example involves cars, axles and wood to illustrate how the Factory pattern lets you generate objects of different types automatically without having to worry about how they're created. He includes a code example in the form of an interface and a class that implements it (the "Axle" class).

PHPMaster.com: Server-Side HTML Handling Using phpQuery


PHPMaster.com has a new tutorial today showing how you can use phpQuery to work with HTML in your application. phpQuery is a server-side CSS-selector-driven based on jQuery's API.



Think about how you can change and manipulate the generated HTML using server-side PHP code. phpQuery is the ultimate solution that will come to your mind. If you haven't heard about phpQuery, you may be interested in this article since I am going to give you a brief introduction to phpQuery and explain how you can use it in real-world projects.


The tutorial shows you how to generate a simple table with alternating row colors (zebra) and column headers from an array of product information. They also talk a bit about why using something server-side like this is important (over something client-side like jQuery) - how it can make things easier by keeping the "business logic" all in one place, leaving your frontend to do what it does best.

Voices of the ElePHPant Podcast: It's the booze talking, episode 2: User Groups


The Voices of the ElePHPant podcast has released their second episode in the "It's the Booze Talking" series as recorded at this year's php|tek conference in May. In this new episode several community members talk about user groups (some as organizers, some as members).


Community members joining Cal on the podcast are:




You can listen to this latest episode either via the in-page player, by downloading the mp3 or by subscribing to their feed to get this and other great episodes.

2012年6月11日星期一

Community News: Latest PEAR Releases for 06.11.2012

Latest PEAR Releases:

Lorna Mitchell's Blog: Fetching Your Talks from the Joind.In API


If you're a speaker (or even if you're not and just want to play with the API) and have information on Joind.in, Lorna Mitchell has a quick way you can pull you information from the site into an easy to use format.



I've recently been thinking that I should also do a better job of linking through to the various talks I'm giving/have given - and at around the same time I was contacted by the good folk at mojoLive about integrating against joind.in. To cut a long story short, the joind.in API now has the functionality for users to retrieve their list of talks!


Her example just uses a file_get_contents to pull the data from the remote URL in a JSON format. You don't need to be logged in to get to the talk information, though, so you won't need to bother with OAuth for this one. A snippet to loop through the results is also included.

7php.com: PHP Interview with Taylor Otwell - The Creator of the Laravel Framework


On the 7php.com site today they've picked back up with their "PHP community interviews" series with this latest interview - a few answers from Taylor Otwell, the creator of the Laravel framework.



In this edition I talked with Taylor Otwell {@taylorotwell}, the man behind Laravel (created in April of 2011) which is a PHP 5.3+ Framework. Taylor is a .NET developer who specializes in elegant, intuitive software. The fact that he comes from a .NET background and he produces such an excellent, solid PHP framework with good standards, is something very inspiring and amazing. His framework, Laravel is very unique in itself and has an awesome community behind; Laravel is getting a lot of momentum and is on its way to being one (or is already?) of the most awesome PHP 5.3 framework.


Some of Taylor's answers cover things like:



  • His advice to budding PHP developers
  • His admiration for Fabien Potencier
  • His work in .NET as a "day job"
  • Details about the Laravel framework (and trials along the road to its development)


You can read the full interview here.

Grzegorz Godlewski's Blog: Choosing your Source Code Management System


In a recent post to his blog Grzegorz Godlewski talks about some of the criteria to consider when selecting your source code management tool (between Subversion, Git and Mercurial).



Each of them has its own advantages and disadvantages so the project's requirements, development environment and team members receptivity should be taken into consideration. Relying on my own experience in project management and using version control systems to manage the development process I've formed the conclusions listed below that may be helpful while considering usage of one of described SCM's in your own projects.


He talks about how the size of the project can effect the decision and a bit more detail about what each of the version control systems are good at. The PHP project itself has recently made the shift to git away from Subversion (you can find more information on the PHP.net site).

Web and PHP Magazine: Issue #3 Released - "MySQL for Hipsters"


The latest issue of the "Web and PHP Magazine" has been published - Issue #3 with articles including:



  • An interview with Razi Sharir, CEO of Xeround, on DBaaS
  • A preview of IPC Spring 2012
  • Sebastian Bergmann (thePHP.cc) on hotels
  • 'An Overview Of PHP QA Tools' by Luis Oblonczyk (Softnex)
  • 'An Introduction To Traits' by Michael Stowe (CaringBridge)


You can download this issue free (registration required) as a PDF. Additionally, if you'd like to see the first two issues, you can check out their archives to download those as well.

2012年6月9日星期六

Site News: Job Postings for the week of 06.03.2012

Job postings for the past week:

PHPMaster.com: More Bulletproofing with PHPUnit's Database Extension


On PHPMaster.com today there's a new tutorial posted about improving on the PHPUnit database testing extension to allow you do other non-query (select) operations - the "C" and "UD" in the typical "CRUD".



In a previous article I discussed how you can create more robust code that queries your relational database through automated testing. But, as you know, querying is just one part of the picture. There are still other database operations, namely create, update, and delete. Just like retrieval, they too should be tested. I'll be exploring the other features of PHPUnit's Database Extensions in this article while building on your knowledge of database testing in PHP.


He helps you get the test environment, complete with the base SQL structure, and the data to test against (and XML structure). They include the sample code to create the test itself and the results when the tests are executed.

Community News: Kohana Community Responds to PSR-1 & PSR-2


In the Kohana framework, you can get an inside look at the discussion inside a framework community regarding their adherence to the PSR-1 & PSR-2 standards (hint: they're not in favor).



A commentor asks the question "Will Kohana eventually follow the following guidelines?" and is immediately given the simple response of "no". Other comments reinforce this by pointing out some of the differences in the standards that the framwork follows and what the PSR standards outline.



Other posters make comments about the PHP-FIG group themselves, some of the things outlined in the standards and some of their own personal preferences when it comes to the the standards of their own code. You can find more information on the standards here: PSR-1 and PSR-2.

Community News: ProTalk Launched! (Audio & Video for PHP Developers)


The project that strives to provide audio and video content to the PHP community has officially launched - ProTalk.




ProTalk is the brain child of Kim Rowan and Lineke Kerckhoffs-Willems. A spark of an idea on IRC in July 2011 transformed into the site you see before you and we really hope you like it.



ProTalk's mission is to provide a central point of access to online audio / video content with a PHP focus. We hope to expand and include other programming languages in the future, but for now we're focussing solely on PHP and surrounding tools and skills.




All of their content is user-driven, so if you have a video or audio recording that isn't linked on the site, be sure to submit it to them and get it added to the site!

Luis Atencio's Blog: Dependency Injection in PHP


On his Reflective Thought blog Luis Atencio takes a look at the current state of dependency injection in PHP and shares a simple refactor from non-DI to code that uses it as a service locator.



If you have worked with frameworks such as Spring or Google Guice, you will understand the power and flexibility that dependency injection provides your humongous code base. [...] One quick drawback that I see is that the stateless nature of PHP makes things like object containers not very practical.


He proposes a slightly different kind of dependency injection system, one more akin to what's provided in the Java world where annotation and reflection are components of the integration. He provides a code sample of how this would look and points to Java's JSR-330 standard for some of the annotation examples (like "@inject" or "@scope").

Project: CodeSniffer for PSR's (PSR-0, PSR-1 & PSR-2)


Klaus Silveira has created a set of PHP_CodeSniffer rules that can be used to test your code for the recently approved PSR-1 & PSR-2 standards.



This is a PHP_CodeSniffer sniff to check against the PHP Standard Resolutions: PSR-0, PSR-1 and PSR-2. Those standards were approved by the PHP Framework Interoperability Group. You can read more about the PHP FIG and the PSR's on this excellent article by Paul Jones.


The github repository also provides an overview of the standards themselves and how to get these sniffs installed.

2012年6月8日星期五

Site News: Popular Posts for the Week of 06.08.2012

Popular posts from PHPDeveloper.org for the past week:

PHPMaster.com: PHP DOM: Working with XML


On PHPMaster.com there's a new tutorial posted about using XML in PHP, an introduction to using the DOM functionality in PHP to work with your XML content.



PimpleXML allows you to quickly and easily work with XML documents, and in the majority of cases SimpleXML is sufficient. But if you're working with XML in any serious capacity, you'll eventually need a feature that isn't supported by SimpleXML, and that's where the PHP DOM (Document Object Model) comes in.


He starts with a brief introduction to XML and DTDs including an example of each (defining a sample book information he'll use in the rest of the tutorial). He helps you create a simple class that takes in the XML content, working with construction/destruction of the object and using it to find, add and delete a book by things like ISBN or genre.

NetTuts.com: How to Process Credit Cards with PayPal Payments Pro Using PHP


NetTuts.com has a new tutorial posted today about processing payments with PayPal using their "Payments Pro" API and a handy library that makes it pretty simple.



While one of its most popular features is the ability to simply sign in to your PayPal account to submit payments, merchants using PayPal can also accept credit cards directly just like a traditional merchant account solution would provide. PayPal calls this solution Payments Pro, and I'm going to show you exactly how you can process credit cards directly with PayPal's API using their Payments Pro web service API's.

They've broken it up into the different steps including:



  • Setting up the configuration
  • Creating a first API request
  • Sending the HTTP request to the PayPal API (via curl)
  • Parsing the response

PerishablePress.com: Encoding & Decoding PHP Code


On the PerishablePress.com site there's a recent article showing you how to encode your PHP project's code (though some of the methods are more obfuscation than actual encryption).



There are many ways to encode and decode PHP code. From the perspective of site security, there are three PHP functions - str_rot13(), base64_encode(), and gzinflate - that are frequently used to obfuscate malicious strings of PHP code. For those involved in the securing of websites, understanding how these functions are used to encode and decode encrypted chunks of PHP data is critical to accurate monitoring and expedient attack recovery.


They show examples of several methods of encoding/obfuscation of the code including rot13, base64, gzinflate/gzdeflate and links to some other resources.

Anthony Ferrara's Blog: To Comment Or Not To Comment - A Tale Of Two Stories


In this recent post to his blog Anthony Ferrara looks at commenting in your application's code and how to be effective (and not so effective) when using them.



A few weeks ago I was sparked into a twitter conversation with Larry Garfield (@Crell) about the value of comments in code. [...] A pretty innocuous comment [about code that doesn't have comments] that is quite insightful. [...] That led to an interesting discussion that just couldn't fit on twitter. So let me explain...


He defines what he means by "comments" (DocBlock, general comments and legal information) and what sort of things should be inside of them. He also points out a few things not to do in you comments including being overly descriptive and restating what the code is doing (they should be less about that and more about the "Why"). Of course, there's exceptions and he touches on those briefly to finish out the post.

2012年6月7日星期四

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

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

Mike Purcell's Blog: PHPUnit - Constant Already Defined - -process-isolation


In this new post from Mike Purcell shares a solution to an error he came across in his unit testing - a "Constant already defined" message - and how he fixed it.



When upgrading the unit tests I had no problem, it was only when I was trying to integrate into CruiseControl that this was happening. Well after some time, I finally figured out the issue was the "ant" command to execute the unit tests was passing the -process-isolation flag to phpunit.


He found that when he called it with that flag, it was executed twice, resulting in the "already defined" message the second time. He fixed it by removing the extra flag. Another alternative is to wrap your constant definitions (and anything that dosen't need to be called/created again) in an "is defined" check.

Michael Nitschinger's Blog: Handling JSON like a boss in PHP


Michael Nitschinger has a new post to his blog about JSON handling in PHP and how to work with it "like a boss".



There are already lots of tutorials out there on handling JSON with PHP, but most of them don't go much deeper than throwing an array against json_encode and hoping for the best. This article aims to be a solid introduction into JSON and how to handle it correctly in combination with PHP. Also, readers who don't use PHP as their programming language can benefit from the first part that acts as a general overview on JSON.


He starts with an introduction to JSON - what it is and what a typical structure looks like. He moves into how to encode JSON in PHP using json_encode, showing teh result of encoding things like arrays, strings and associative arrays. He also includes a bit on translating an object and the resulting JSON string. He mentions the options bitmasks, shows how to decode JSON you're given and talks about error handling and testing of the results.

Chris Hartjes' Blog: DIC vs. Service Locator


In a new post to his blog, Chris Hartjes shares one thing that you can use to make your code easier to test - using a dependency injection container and how it compares to a service locator.



People often ask me what's the one thing they could do for their code base RIGHT NOW that will make it easier to test. To me, the answer is simple: make sure you are using Dependency Injection (yes the link is long and has code samples in Java, but whatever). Without the ability to "inject" your dependencies into your code (whether it is class methods or functions) you will have problems testing modules of code in isolation from each other.


He shows the possible uses of DICs, including code samples, and talks the differences between the two. He explains that the real difference in them is how its being used. When it's used to add and remove instances, it's a container. When its actually put to use and passed into a class, it morphs into a service locator.

Dave Marshall's Blog: How I'm doing TDD with PHP


Dave Marshall has shared his method behind using test-driven development in his recent development.



I've been watching the Destroy All Software back catalog over the last couple of months and it's really inspired me to up my TDD game. I'm still fairly new to TDD, I've written tests for a long time, but never really let it lead my development…


He talks about the testing tool he uses and some of the ideals he keeps in mind when developing his tests. He also comments on testing isolation, speed of execution, the "fail fast" idea as well as integration testing and continuous integration.

2012年6月6日星期三

Community News: Latest Releases from PHPClasses.org

LineshJose.com: How To: Create A Simple CSS Compressor Using PHP


In this recent post to his blog Linesh Jose shows you how to create a simple PHP-based compressor for your CSS (using some string replacement methods and a regex or two).



CSS or Cascading Style Sheets is a language used to describe the presentation of a document written in a markup language. If you're developing a very complex design for your site, CSS scripts become very long, and takes too much time to load. But a compressed CSS script can help your website load faster and easily maintain its functionality. Here, I've created a very simple CSS compressor using PHP to compress or reduce CSS script size.


You can read through the example code and see how it all works or you can download the code and see a live demo of it in action. His script does the compression on the fly, but it's not a far stretch to get it set up as a part of a build to output to a file on deployment.

2012年6月5日星期二

Community News: Latest PECL Releases for 06.05.2012

Latest PECL Releases:

Henri Bergius' Blog: Running Symfony CMF with Midgard2


In this new post to his blog Henri Bergius shows you how to run the Symfony CMF with Midgard2 content repository.



I've written about Decoupled Content Management before. As the Symfony Live event in Paris is nearing, I thought to give Symfony CMF a spin. Symfony CMF is a new approach at building PHP content management systems, and adheres quite well to the principles of decoupled CMS.


He helps you set up the needed dependencies and content schemas as well as the YML configuration you'll need to set up to get the content repository backend working and integrated. Some command line calls are included to "prime" the database and the application should be ready to go.

Paul Jones' Blog: PHP-FIG: PSR 1 and 2 Accepted


As Paul Jones mentions in his latest post to his site, the much talked-about PSR standards that were proposed by the PHP-FIG group, PSR-1 and PSR-2, have been accepted.



Earlier today, the PHP Framework Interoperability Group accepted two standards recommendations. [...] There's been a lot of commentary about these proposals over the past two weeks, some of it positive and some of it negative.


He includes links to some of the commentary that's been made about the standards recently, and spends some time responding to some of the negative comments specifically, like:



  • What the hell is the "PHP Standards" group? I've never heard of it before now.
  • Why are you guys so secretive and closed?
  • So once I join the list, I can vote on PHP-FIG Standards Recommendations? Sweet!
  • Whatever. I don't need you guys telling me what to do. If I don't want to follow your so-called "standards" then you can't make me.

Sean Coates' Blog: Deploy on push (from GitHub)


Sean Coates has a new post today sharing an example push process for the times when you either just need to push code (without the build process) or you're just deploying something simple - a "deploy on push" hook built into your github repository.



Sometimes, you just need to deploy code when it's ready. You don't need a build; you don't need to run tests - you just need to push code to a server. If you use git and GitHub (and I think you should be using GitHub), you can easily deploy on push. [...] There are really only three things that you need, in most cases, to make this work: a listener script, a deploy key and associated SSH configuration, and a post-receive hook.


He explains what each part of the process does and includes the simple PHP script that github calls to make the deployment (it's specific to his example, but you get the idea). He walks you through setting up the deploy key (a SSH key generated on your server) and how to get SSH to use this key when github comes knocking.

MaltBlue.com: Zend Form Mastery with Zend Config - Part 4 Configuring Zend Validators


On the MaltBlue blog Matt has posted the latest part of the "Zend_Form with Zend_Config" series, part four looking at using and configuring some form validators.



Welcome to the fourth and final part in the Zend Form Mastery with Zend Config series. Previously we looked at the basic form options, element and form wide prefixes, filters and element options. In this installment, we're going to look at configuring Zend Validators via our XML config. [...] To go in to all of them will take more time than is allowed in the confines of this article. So we're going to work through 5 of the more interesting and likely used ones.


He covers the validation for: email addresses, postal codes, seeing if a record exists in the database, IBAN validation and checking to see if a value is in an array. He gives XML examples for each of these validation methods including the definitions of options and error/feedback messages.

2012年6月4日星期一

Joshua Thijssen's Blog: Using augeas (in PHP)


In this new post to his blog, Joshua Thijssen looks at using the Augeas tool in a PHP application. Augeas is a configuration editing tool, making it easy to parse many different types of configs and transform them into a tree structure.



Even though I really like using sed and awk, sometimes its hard to change or add parameters in configuration files. Big sed statements that may or may not work, double checking if everything has been done correctly etc. Augeas is a really cool tool that lets you view / add / modify and delete all kind of data from configuration files. If you are using Puppet, you are probably aware of this tool, but I notice that a lot of PHP developers have never heard of it.. Let's explore..


He shows an example of a configuration file and how the "augtool" command line script can be used to modify one of them. He then shows how to use the tool's library to set the server's "date.timezone" setting in the php.ini.

Ilia Alshanetsky's Blog: Database connection fallback with PDO


Ilia Alshanetsky has a new post to his blog sharing a method for fallback with PDO when your database connection fails.



For our database connections we PDO at work and we've extended the class with PHP to offer some other convenience functionality and wrappers. One of the things I wanted to do recently is allow the constructor of the PDO class to fail-over to our backup database connection pool in the event the primary was not available.


He wanted his code to catch an exception if the object was created with a failed server host and to connect to the backup instead. PDO doesn't cooperate with this method and just destroys the object when there's a failure. His work around is in this patch to the PDO support in PHP to provide a new constant, PDO:: ATTR_KEEP_CLASS_CONN_FAILURE, that tells the script wether or not to destroy the PDO object when there's a problem.

DevHell Podcast: Episode 13: #tek12 or Something. I Don't Know


The Dev/Hell podcast (as hosted by two PHP community members, Chris Hartjes and Ed Finkler) has posted their latest episode - Episode 13: #tek12 or Something. I Don't Know. (This episode was recorded live at this year's php|tek conference.)



This episode was recorded at the tek12 uncon in front of a live studio audience. We talk about pair programming, what we'd recommend to folks who want to start programming, the PHP-FIG & PSRs, and our favorite events from tek12. Also Chris punched Ed a couple times. It hurt. Video hosting for this episode is provided by WonderNetwork, who generate some really cool ping data. This was lots of fun, and we want to thank all the folks who came out and participated.


You can listen to this latest episode in a few different ways - using the in-page audio player, downloading the mp3, subscribing to their feed or grabbing the video of the live recording.

PHPClasses.org: Lately in PHP, Episode 24 - Do PHP Developers Need & will Adopt PHP Coding Standards


The PHPClasses.org site has released the latest episode in their "Lately in PHP" podcast series - Episode 24, "Do PHP Developers Need and will Adopt PHP Coding Standards?"



The PHP Standards Group is trying to push new specifications for PHP coding standards. Whether PHP developers need and will adopt these standards was one of the main topics discussed by Manuel Lemos and Arturs Sosins in episode 24 of the Lately in PHP podcast.


They also talk about some of the comments that Linus Torvalds recently made about the limitations of Github and recent PHP releases (bugfixes). You can listen to this latest episode using the in-page player or you can download the mp3 and listen locally. If you enjoy it, consider subscribing to their feed to get this and future episodes.