5 Tips To Speed Up PHP Development(Page 1 out of 2)
As PHP developers, we all like to create our PHP scripts as fast as possible, and we try to take any shortcuts that we have. In some sense we are quite lazy, and we hate doing all the grunt work. That's why I'm going to give you five tips to really speed up your PHP development, and save some serious time. If you're an experienced PHP developer, these tips will probably seem very obvious to you, so this article is geared more towards beginners.
Tip #1 - Use a good editor or IDE
Using a good editor can really save you time. If you're still stuck on using Notepad to edit your PHP scripts, switch right now. There are plenty of free alternatives around, such as PHPEdit or EditPlus 2 (Shareware). The biggest advantage you get with a proper editor is code highlighting (automatically coloring your code). Code highlighting can help you debug your scripts, or follow code logic. Most editors support code highlighting, and if yours doesn't, then you know it's not suited for coding.
Another great advantage of using a good editor is the ability to do powerful search-and-replace operations. I know for a fact that EditPlus 2 supports regular expressions in their search-and-replace functionality, and I bet most editors do. It just makes it so much easier to replace a snippet of code. Imagine having to replace something by hand hundreds of times. Think of the time that gets wasted.
You can also use a full-blown PHP IDE (Integrated Development Environment). Unfortunately, there aren't many PHP IDE's, and most of them are quite steep in license fees. The best one on the market is Zend Studio, by Zend (the company backing PHP). An IDE can really save you time, by making the debugging process easier, and some IDE's (such as Zend Studio) also include IntelliSense, which will help you with function names and such (e.g. you start typing file_get.. IntelliSense shows a dropdown that matches what you were typing. It's brilliant).
In short, use a good PHP editor or IDE, and you'll save a massive amount of time!
Tip #2 - Use a framework or skeleton
Most of your PHP scripts will probably do many of the same tasks, such as database functionality (insert, update, select, delete), and have many of the same functions. You could re-write these functions and tasks every time you start a new project, but that seems a bit pointless. Instead, you could use an existing framework or skeleton, and base your new scripts on that.
You can either use a full-blown PHP framework, like CakePHP or the Seagull Framework, but you can also use a very simple skeleton that you create yourself. It doesn't have to be complicated at all, and can even be just one file which contains all the functions you commonly use.
If you've already written part of your new script, you've already saved time, no matter how much or little you've already written. If you use a framework, the structure of your script has also been determined already (largely), which can also save time.
In short, you should try to re-use as much code as you can, and try to create (or download) some short of skeleton or framework to really speed up development.
Tip #3 - Don't re-invent the wheel
Continuing the previous tip, something that really speeds up development is using existing solutions. I'm not talking about a skeleton or framework, but using a full-blown script, and customizing it to your needs.
If you're going to build a CMS for your website, which is actually one of the most common things PHP developers create, then you should first look at existing scripts. There are plenty of great scripts already, and many of them are completely free, often licensed under an open source license, such as the GPL license. A good example of this is WordPress. Originally, WordPress is a blogging tool, but it can easily be used as a CMS for your website, and you can even extend it using template hacks, plugins or code modifications. This will save you a significant amount of time, which means you can focus your time on other tasks.
Of course in some situations, when you have really specific needs, it won't be possibly to use an existing script, but before you start, try and find something that resembles your needs. Have a look on HotScripts and search Google. There's a big chance that it already exists.