PHP+Capistrano+Shared Host = Easy Deployments

I wrote a Rails app that was deployed with Capistrano and I loved it. Every time I made a change, one file or a dozen, I could get all the files up in a single command. In addition, if anything was broken I could revert to the previous deploy with cap deploy:rollback. While using Capistrano […]

Continue Reading

Add Flash Messages to Your Site

Flash messages are often used to give feedback to the user when an action has taken place. Such as, when they have logged in or tried to access a page without permission. How it Works Flash messages are set in $_SESSION[‘flash_messages’]. At the beginning of every page request we store them in a variable and […]

Continue Reading

The Basics of Creating a CMS with PHP

When people want to build a website for someone, they usually need to create a Content Management System (CMS) that allows the client to manage their own content. And while there are thousands of prebuilt CMSes that can get the job done, it can be very helpful to learn how to build one yourself. What […]

Continue Reading

Creating a cycle() function in PHP

I love using the cycle helper in Rails and I’ve always wished PHP had something similar. But every time I created one I ran into the same problem every time. How do I use multiple cycle calls in a single loop? I happened to look at Rails’ source code and noticed it allowed a specific […]

Continue Reading

Benchmarking PHP Script Speeds

I recently learned about jsperf.com and I’ve really enjoyed looking at the speed results of different pieces of code. However, I couldn’t find any sites that did the same for PHP and I’ve really wanted to test different ideas that I’ve had. How it should work There were a couple of things that I wanted […]

Continue Reading

Lazy Loading with PHP

I’ve been looking through a lot of PHP projects on GitHub lately and I keep seeing people including all their classes on launch. And unfortunately it’s the reason I decide not to use their code. What is Lazy Loading Lazy loading it a pattern of only including classes when they are needed. And fortunately enough […]

Continue Reading

Huck – PHP Testing Framework

Huck is a Behavior Driven Development (BDD) framework based on Jasmine for JS. It is designed with a simple syntax to give it a fast learning curve. Getting Started Huck runs in the browser so you don’t have to load terminal. Just upload it to your server, create the specs and load index.php. Huck will […]

Continue Reading

PHP PubSub

A little over a year ago I read a post on Nettuts+ regarding PubSub with jQuery. The idea is you create (or subscribe to) a collection of functions that are called when you publish an event in your application. It seems like something that only works in javascript because php doesn’t deal with user events. […]

Continue Reading