The Best of PHP 2010 - 2011
During last 6-8 months I did quite extensive research regarding various PHP open source or dual licensed (e.g. community editions) applications. Here is my list of what I found best currently available PHP software. Please note, that this is my personal opinion based on my own tests & experience, and I might have easily missed out other great stuff. It is in no way meant to disrespect great work of other PHP developers. I will try to be objective (subjectively objective:-)) and provide also brief explanations for my choices.
Best PHP Framework: Yii Framework
I discovered Yii about 5-7 months ago after weeks of exhausive search for fully PHP5 compliant framework with support for multiple databases or capable of running even without any database dependency, support for JQuery, multisite installations and multilanguage support inside each subsite (I mean subsites installed on a single doamin subdomain, e.g. php.synet.sk or blog.synet.sk would be two subsites).
The database requirement proved to be hardest thing to satisfy. Since I am well familiar how painful is it to write cross-database compatible queries, I was looking for unified database layer shared commonly between main stream databases (oracle, mssql, postgreSQL and mySQL). I figured out that only PDO-based database layer is capable to provide sufficient performance due to (semi) unified SQL commands and emulation of cached queries. Believe me, if you are developing product for more than one client, you are very likely to deal with various requirements - first company wants to run on MS SQL Server, another wants has licensed Oracle 11g database. If you are using specific database driver for each database, sooner or later you will stumble over problems like characters escaping, single quotes versus double quotes problem, different results for aggregate functions (group by), limiting returned recordset (why da heck does not have MSSQL clause LIMIT from,to just like mySQL does?) etc etc never ending story of individual SQL implementations of individual vendors. The only way how to deal with this is to sacrifice some performance and use simplified SQL queries with PDO database extensions. Yii's database abstraction object (DAO) is fully based on PDO and provides one of best performances and features rich set all-in-one.
Besides good database layer, Yii integrates other stuff I have been looking for, e.g. JQuery, Unit tests, localization for multiple languages, caching, tools for automated development tasks (CLI commands - e.g. for collecting localized strings) etc. What's the most important is performance - average memory comsumption for basic site is about 3.2 - 3.5 MB which explains amazing Yii's performance. Yii is actually the only framework of second generation I know so far - meaning it is from scratch rewritten former Prado framework. If guys from CakePHP or CodeIgniter wants to keep up the pace, they should drop backward compatability (with PHP4) and rewrite their frameworks from scratch with performance in mind. Kohana is also great PHP5 framework, however it's bottleneck is database layer based on non-PDO extensions.
And what about Zend framework? Uhmm... it's great study library written without having practical usage in mind. Use it for studying one of best PHP techniques, but unless you are running dedicated PHP server with large memory (with opcache) I do not recommend using it.
Symfony 2 claims to outperform all other frameworks - well, I did not benchmark overall performance, but I give Symfony one reason why I don't favour it - configuration YAML approach. Yii requires zero configuration and yet you have enormous configuration possibilities if you need. Zero configuration is for a developer great time saver.
Read more:
- Yii framework
- Choosing the best PHP framework
- PHP Framework benchmark: Zend, CodeIgniter & CakePHP
- Choosing a PHP Framework
Best PHP database layer (ORM): Doctrine, Propel
These two guys deserve huge respects - both are GREAT database object relational layers and both have their pros & cons. People usually find Doctrine's API more intuitive, whereas Propel does better in most benchmarks. It will be interesting to compare the two guys after Doctrine 2 (Reloaded) stable is released. Personally, I do not use either of these ORMs in my applications since I use Yii's built-in ORM, but I studied their code & I think these are definitely best PHP applications in their category.
One should note, that both ORMs put extra performance load on your server. It's like having another application inside of your application and it is recommended to use opcache if you decide to use them. Personally, I would use them if - for some reason - I would need a standalone ORM without framework.
Last note goes on ADOdb - PHP database abstraction library written for old PHP 3-4 since 2000. Yet in these days this library gives one of the best benchmark results. However, it has outdated old PHP code written for different object model, not for PHP5. Use it if you need PHP4 aplpication or you don't care about ADO, Active Record (AR) and other advanced database manipulation techniques brought to you by PHP5.
Read more:
Best PHP unit test platform: Simpletest, PHPUnit, Selenium RC
Simpletest would be my choice #1, if the development would not suffer for years. It's advantage is great architecture, simplicity, integrated http client (even though cannot parse javascripts). I took look into SVN repos - there is a lot of collected stuff for ongoing release, but it looks messy, as if waiting for full integration into framework itself. Therefore and because PHP Unit is much more actively maintained, I consider both frameworks for very comparable and competetive.
Extra category is Selenium Remote Client (RC). This is a java application capable of communication with PHP script (or other scripting language). That means you write script (e.g. PHP) which sends commands to Selenium Core server like "click link [Home]" or "get value of element [title_label_1]" etc. It can also record step by step your actions via Firefox plugin (Selenium IDE) and play back recorded actions - extremly useful stuff for developers, and particularly testers. Both frameworks support layer for communicating with Selenium Core server. Drawback for running Selenium however is, that you must start Selenium Core Server as java application - and this is tough thing to do through PHP (to control behaviour of java application by PHP) achievable only via integration of PHP - JAVA Bridge (or buying Zend Platform commercial license with integrated PHP - Java Bridge). A workaround is also needed for interpreting Selenium logs into human readable form e.g. like Canoo test server does.
Read more:
Best PHP shopping cart: Oxid eSales, PrestaShop, OpenCart
Oxid eSales is commercial online e-shop (eCart) with some nice features and really good performance. Distributed under dual licensing model (commercial and free community edition GNU GPLv3) proves to be fast and stable during my tests. For database operations it uses adodblite so it should support multiple databases - but I did not test it. It does not provide such extensive admnistrative options like Magento, but most of things needed to manage your online sales are there. It uses Smarty as underlaying templating engine. Unfortunatelly, templating system is not really easy since only basic frontend theme consist of more than 120 template files - this makes theming virtually impossible:-(
My another choice for shopping cart software would be PrestaShop. Along with really good performance and stability it comes with robust administrative section integrating statistics, user-employees-supplier-catalogs and everything you may need. There are also over 100 modules and 500 skins available on community sites (free and commercial). Similarly to Oxid eSales, Prestashop also utilizes Smarty as templating engine (I found there Smarty version from 2005 - time to upgrade, guys?). Theming for PrestaShop means converting about 45 files and thus makes skinning more viable to designers.
If you prefer simplicity over robustness, your choice might be OpenCart Shop. It's PHP5 MVC based shopping cart with smooth skinning and neat frontend functionalities. It's greatest advantage is it's simplicity and intuitive administration. There are lots of extensions (modules, themes) available by 3rd parties - which means they may or may not work always correctly - depending on authors.
Last word goes on Magento. Magento comes with unbelievable number of options and extremly robust admin interface. Magento commercial themes (skins) are one of best earning themes these days. However... performance, stability and extensibility... whooo.. Sorry, guys, time to reload... and spend some time on rewriting Magento from scratch with performance in mind. Magento requires extra large memory (php comes with default 128 MB, but Magento recommends at least 512 MB) because it uses Zend Framework as underlaying framework which is written.. well, not quite with real-world usage in mind. Magento's code itself also acquired some critics for being messy and badly architected. All in all, Magento is a heavy industrial application suitable to run only on dedicated high-performance tuned servers. Magento is not for common web hosting which mean extra costs for sellers and yet is not a guaranteed to run better than its though less robust, but more stable brothers.
Read more:
- 8 Best Open Source Shopping Carts
- Magento or Prestashop, which is better?
- Magento vs. Prestashop
- Magento vs. Oxid - My first impressions
Best PHP CMS: WordPress, Drupal, Joomla, Typo, Modx
This is a tough call. Each CMS suits different target community for different needs, so it's really not easy compera them objectively. Other guys digged enought into that, so I will just list all these applications as the best of PHP as of 2010. Shortly, your choice might be (ordered from easiest to the most difficult to learn):
Wordpress - choose, if you need simple blogging website with quick deployment, solid security, SEO links and great performance, easy learning curve, lots of modules and templates by third party. About 8% of websites are running WordPress.
Joomla - choose, if you want full CMS system with some special tasks (Photo galleries, document management, ...) and yet simple enough to administer. There is over 6000 extensions by 3. parties available for Joomla community. Version 1.5+ has undergone significant rewriting of codebase which rectified some previously criticised features (lack of access control, lack of support for multisite installations, SEO optimization issues etc). By installing module VirtueMart you may turn your CMS into (somewhat limited) online shop. Joomla is mostly a choice for PHP non-professionals due to its intuitive administration.
Modx - very neat CMS based on AJAX framework. It's a winner of category Most promising CMS in 2007. It's learning curve it similar to Joomla due to intuitive administration. Give it a try if you find Joomla clumsy.
Drupal - choose, if you want fully featured CMS and don't mind more complicated administration. Professional developers tends to favour Drupal. In my opinion, Drupal is an old fashioned guy carrying all his archaic heritage over last 5-7 years from one release to another release. Developers are simply afraid to break backward compatability and to risk loosing parts of community (understand: loosing money). If the guys would rewrite Drupal into fully OOP PHP5.2+ compliant CMS, they might restart new Drupal's era.
Typo - this is CMS used for deploying heavy industrial websites. It's difficult to teach your customers how to use it (high tution costs), or at least it would cost you more than teaching administration of Drupal / Joomla. However, Typo's complexity also means that you can do virtually anything - it's extremly powerful, robust and flexible CMS, mainly due to its (somewhat complicated) TypoScript language. Learn Typo if you are looking for a job in Germany, Austria or scandinavian countries.
More experienced guys wrote more on the topic:
Best PDF generator: TCPDF
TCPDF is my choice #1 for creating professional PDF documents. It has been ranked as one of the most active SourceForge projects in 2009 and supports most of important PDF features, including signing PDF with certificate, bar codes, unicode support, embedding font subsets, various ISO fonts, access protection control, SVG graphics, HTML and CSS to PDF (limited) conversion etc. If wrapped into FPDI and TCPDF bridge, it can import binary templates from any supplied PDF file - worthy usage option for fast development of PDF documents with PHP. In this setup (TCPDF with FPDI), it can also parse already created PDF documents, manipulate with document (e.g. sign with certificate, extract particular pages, split PDF document etc) and save it back like new document. A little drawback of TCPDF is the size of the main file (cca 900+ kB) which makes it less comfortable to read and means loading even methods that are not needed.
Other: PHP - JAVA Bridge
PHP - JAVA Bridge gives you ability to control JAVA from within PHP scripts and vice versa. It implements its own protocol between java servlet and PHP webserver. A typical installation migth be installing Apache Http server to run standard PHP applications on port 80/443, and Apache Tomcat as java server with deployed JAVA Bridge (JavaBridge.war) on port 8080, both running on the same machine. This is great tool, since industrial web implementations often require hybrid production environment - e.g. to serve static pages and intranet CMS through Apache Http with PHP, and serve special database operations via java applications.
Read more: