To PHP or not to PHP…Let the Framework Debate Begin! (Part 1)
While PHP Frameworks have become quite popular with web developers over the last two years, they have their drawbacks. They can be bulky and/or bloated, bringing the simplest of tasks into a fold of dependencies and data calls. They can be difficult to administrate remotely – if you use a shared host, some command-line configurations options are immediately disqualified. You may just be looking for a helper library, but do not want to drag your application through the mud of an entire framework to get one piece of functionality.
Discussions can be had about the consequences when using a framework, but there are programmers just looking for simple helper libraries. Fortunately, for the PHP programmer, those are in abundance. Here’s are some rock-solid examples of third-party libraries available for PHP:
1) PHPMailer – Available here, the PHPMailer library has really grown in the past year! There is now a set of API docs, separate classes for list management, flash-based email forms, and more. Great for extending the extremely limited functionality of PHP mail().
2) Xajax – Available here, the Xajax library is a small helper library for writing Ajax callback functions using just PHP. PHP-based Ajax helper libraries may be going the way of the dodo in lieu of javascript-based libraries and PHP Framework Ajax-integration. Has a plug-ins section and good docs.
3) PEAR – Available here, PEAR is comprised of two parts.
- A base library for writing PHP “extensions” and inheriting common functionality such as exceptions and object inheritance. Useful for PHP4 coders.
- A package manager for distributing and downloading packages written that inherit PEAR’s methods.
Literally hundreds of third-party libraries are available in PEAR, but beware – your application’s package structure, or the classes themselves may need to be adjusted if you use want seamless integration. Also check package licenses! If you pre-compile to byte-code you may violate a PEAR package’s license.
4) eZ Components – Like PEAR, eZ Components provide multiple libraries to assist in PHP application building. Unlike a Framework, though, you can integrate only the eZ Components you wish to use and no more. This is done through an autoloading setup that can either use PHP’s __autoload() method, spl_autoload(), or a bootstrap file if you are planning to use this as a full framework. Speaking from experience, use spl_autoload() if you want to integrate this into your application. eZ Components autoloaders are very unique to themselves.
And that’s all! More libraries and frameworks will be covered in future blogs.