Skip to main content

Posts

Showing posts from September, 2012

PHP Design Patterns

Resources: Wikipedia has a good article on design patterns. The C2 Wiki is another good place to look for information about design patterns like observer , singleton , and more. The original Design Patterns book is a must-read for any engineer. O'Reilly's Head First Design Patterns is a lighter-weight way to get into design patterns. The book PHP Hacks has several hacks for design patterns that extend beyond the examples shown here. See the developerWorks article " Five more PHP design patterns " to learn about five additional design patterns that you

Database migrations using DbDeploy & Phing

Install Phing The best way to download and install phing is using PEAR . This can be done on Linux or Windows assuming you have the pear script in your PATH with three shell commands. shell> pear channel-discover pear.phing.info shell> pear config-set preferred_state beta shell> pear install [--alldeps] phing/phing Example Application structure As an example, we’re going to develop a simple application with the following directory structure. example/ |-- db/ | `-- deltas/ |-- deploy/ | `-- scripts/ |-- library/ `-- public/ The db directory contains sql files for using and manipulating our database and the deploy directory contains our build scripts that set the migrations in motion. The library directory contains our application code and the public folder will contain scripts and files accessible directly from the web, but will not be the focus of this article. Build scripts This section shows you how to develop the build scripts that will run ...