Many people think web developers are lazy, but that’s not always true. One thing I can confirm is that we don’t like repeating ourselves. Unfortunately we sometimes do it without even knowing.
This blog post is going to briefly explain how I’ve managed to automate almost every part of my PHP web development.
Below are some important tasks you should also automate:
1. Mac/PC setup for web development
Make sure you’re never manually clicking, loading or running any apps EVERYTIME you open your computer. Add them to a script or batch file, and load it in your Startup Folder or Login Items. Here’s what I have: Text Editor, Browser, Terminal window (x2), Mail App, News Reader, Music Player, Apache, Mysql (server). For me, it takes these to get right into “web development mode“.
2. Creating an application (database,framework,repository)
Most web applications use a database, a framework, and a repository for source control. If you’re not using those 3 then this post isn’t for you, or you’re just not in the loop ;) Let’s assume every web application you develop uses this formula. You need to create a script which automates database creation, automatically loads your favorite framework, creates a repository for your application and imports it.
3. Version control through text editor
What’s fun about version/source control when you’re constantly switching to a Terminal window to update, add and delete files? Automate it! If you use TextMate then you’ll love the neat Subversion bundle. If you use Smultron, you’ll need to define a set of custom commands. Either way, this will save you a ton of time when writing code.
4. Updating applications (WordPress, CodeIgniter, etc)
You just created a custom wordpress theme, tweaked the config file and got everything working properly. All of a sudden, WordPress announces a new version of their application. Important security fixes! Uh oh! Have fun updating! Don’t skip a step, or your blog won’t work! A total nightmare, right? WRONG! Just automate it! How? It’s called vendor branches. Ask Google. Once you get it, you’ll be on your way to updating WordPress in 1 simple step.
5. Website deployment (no more ftp!)
Everything works locally, so now it’s time to deploy! How do you deploy your new application without any downtime? With FTP, you can upload the application under a different name, rename or delete the old one, then rename the new one. You can try to overwrite the application and hope it works. Or you can automate it. Time to bring out the big guns. Capistrano! It is made for that and yes it works with PHP applications. Once you have it all setup, you’ll be able to deploy your new application and updated versions with 1 simple command.
I know this seems like a lot of work, but once it’s done, you won’t have to worry about repetitive tasks and everything will just work.