5 Tips To Speed Up PHP Development
(Page 1 out of 2)Introduction
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.
October 24th, 2005 at 12:04 pm
I’ve gone through many articles to find and understand good PHPFramework.
I did find many articles and frameworks.
But this article helped me a lot not in the sense of the ‘Speed Up PHP Development’ but in the sense of good framework like Seagull, CakePHP.
Thanks a lot.
Regards
Millisami
October 24th, 2005 at 12:10 pm
HI,
The advices you have written are very good and practical. The soutions you have given can really save developers time.
Thanks
Harinder
October 25th, 2005 at 3:25 pm
Another good PHP editor, (sorry linux only), is Quanta Plus…I use it all the time. Code completion, syntax highlighting, project based, etc….and its free
October 25th, 2005 at 7:23 pm
I use EnginSite PHP Editor/IDE from Luckasoft. It’s excellent!
http://enginsite.com/php-editor.htm
October 26th, 2005 at 11:06 am
And another good PHP editor ive found is one called PHP designer 2005. Occasionally a little buggy, but free and one thing i like is that you can set it to type the close of brackets when you open them, and puts the cursor in between. Also has a syntax checker if you download the php intepretor
October 27th, 2005 at 2:37 am
I too use PHP Designer 2005. It is very handy, especially when you download the interpretor (http://www.php.net/downloads.php). The interface shows the includes and classes in a tree so you can see the layout. Also has the code coloring for HTML, CSS, XML, PERL, JS, VB, C# and even SQLs. As stated in the beginning of this article, I used to be one of the ‘notepadders’. :) I must admit though… Not having to count lines to find an error (with wordwrap turned off) is worth a lot to me!! Great article, Thanks much!
October 28th, 2005 at 11:34 am
There’s no alternative for speeding up things to Zend Studio. Code coloring is a must for even a text viewer nowadays. And you should use PHPDOC type of comments, not //some thing ones…
October 28th, 2005 at 4:12 pm
I don’t really like PHPDoc type of comments myself. I find them really annoying, and it really clutters up my PHP files. I’d rather have the documentation seperate.
November 22nd, 2005 at 10:04 am
I have a license that I bought for Zend IDE, and I actually prefer (and use) jEdit over it .. it’s far faster and has a great set of plugins that can be added in very easily: http://jedit.org
February 9th, 2006 at 9:41 pm
For me the best editor is Notepad++
February 23rd, 2006 at 3:39 am
I have been using a framework not mentioned in the tips called Zoop Framework for PHP. It has really helped me productivity wise. Thanks for your tips. Additionally I have been using Quanta myself as an Editor. It doesn’t have a windows port, but runs great on linux and macOSX, is free, and has an Intellisense like feature.
May 17th, 2006 at 8:11 am
I would have to disagree with the part that says: Don’t re-invent the wheel. This is a very limited way to tell php programmers, as being lazy and not promoting development. Yes you can customize those scripts, but why do that when you have to ability to code your own. Who cares if it takes a little while, atleast it can be a very good learning tool. But I do have to say people new to php could use one of those, but don’t discourage ones who are able to code their own CMS, or whatever.
July 6th, 2006 at 7:54 pm
I partially agree with the author BUT i have to say, that many Frameworks as well as Scripts have various downsides, which could well slow down the development process in the long run:
1.) Licenses: What to do if you used a script / framework under GPL (free) and want to go commercial?
- You have to publish all of your code, what in turn makes the whole application vulnerabe, because everyone can see your source.
2.) Functions: What if you depend on a framework and some day need to implement functionality, which the framework does not provide.
- You have to rewrite the app or extend the framework itself. All your changes are like to be lost after a applying a Framework (sourcecode) update.
3.) Modules: So you use modules for your framework to speed up development, huh?
- Many bad things can happen to your app: Sourcecode of every module you use is public (vulnerable).
- Licenses can change, can be tricky or expensive.
- Updates of the framework can break the module.
….
There are many other concerns on this topic but they would be out of scope of this posting.
For my work as freelance programmer and systems professional i always “reinvented” the wheel and this is what i got:
Thin, fast, reliable, “personal” and secure Applications or Daemons.
No other solution than the tailored one can really do what you (or the customer) want to do it.
Frameworks and CMS are often slow, unsecure and offer all-singing-all-dancing stuff, you really will (probably) not need.
I always said: Quality overrules Quantity.
If more Programmers and Companies would get the point of this statement, there wouldnt be so much, really much, crap pieces of software out there.
Additionally, speeding the development process (which includes analysis and design AND testing / debugging) has negative effects on the income of the developer and the financial expectations of your customers. This is where relationships between development, open source, closed source, marketing and so on come into view and covering these here would be FAR BEYOND the scope of the article and this posting.
It always is hard for the worker when the market exploits his industry.
Greetz,
makro
July 12th, 2006 at 1:07 pm
1) Publishing your source code does -not- make it more vulnerable. Bad coding does. Publishing bad code only makes it easier to find the loopholes.
2) Extending a framework is easier than writing the whole thing from scratch.
3) Licenses can’t change on the current version of a module. Future revisions, yes, but not the current one. Update of -anything- can break your code. That’s life. It’s still a -lot- faster to fix the new problem than write everything from scratch.
The programming market is changing. Speed of code is not nearly as important as it used to be, and speed of creating code is much more important.
There will always be jobs for ‘reinvent’ people, but the current market trend is towards ‘reuse’ people.
July 25th, 2006 at 7:51 pm
Frameworks are good. But make sure you select one that you are comfortable with. Don’t just follow the pack.