Monday, January 05, 2009

Simplicity and extensibility are the main reasons why PHP became the favourite dynamic language of the Web. In the last decade, PHP has developed from a niche language for adding dynamic functionality to small websites to a powerful tool making strong inroads into large-scale Web systems.

Below I present 30 useful PHP classes and components that you can use to test, develop, debug and deploy your PHP applications. Let me know if I missed anything or if you have something to add.


Database


Creole


Creole is a database abstraction layer for PHP5. It abstracts PHP’s native db-specific API to create more portable code while also providing developers with a clean fully object-oriented interface based loosely on the API for Java’s JDBC. Creole was originally created as a sub-project of Propel to meet specific needs that none of the available abstraction layers were able to address in any satisfactory way.

LINQ for PHP

LINQ is a component that adds native data querying capabilities to PHP using a syntax reminiscent of SQL. It defines a set of query operators that can be used to query, project and filter data in arrays, enumerable classes, XML, relational database, and third party data sources.

ADOdb

ADOdb Database Abstraction Library for PHP. It supports MySQL, PostgreSQL, Interbase/Firebird, Informix, Sybase SQL Anywhere, Oracle, MS SQL 7 and 2000, SAP DB, Sybase, DB2, FrontBase, Foxpro, Access, Netezza, LDAP, ODBTP, ADO, and generic ODBC. It also features portable database creation, database-backed session support (with encryption), SQL performance monitoring and database health checks.

Propel

Propel is an Object-Relational Mapping (ORM) framework for PHP5. It allows you to access your database using a set of objects, providing a simple API for storing and retrieving data.

Doctrine

Doctrine is a tool for object-relational mapping in PHP. It sits on top of PDO and is itself divided into two main layers, The DBAL and the ORM. The Doctrine ORM is mainly build around the ActiveRecord, Data Mapper and Metadata Mapping patterns.

PHPillow

PHPillow is an object orientated wrapper for CouchDB.


Development


phpDocumentor


phpDocumentor is the current standard auto-documentation tool for the php language. Similar to Javadoc, and written in php, phpDocumentor can be used from the command line or a web interface to create professional documentation from php source code. phpDocumentor has support for linking between documentation, incorporating user level documents like tutorials and creation of highlighted source code with cross referencing to php general documentation.

HTML Purifier

HTML Purifier is a standards-compliant HTML filter library written in PHP. HTML Purifier will not only remove all malicious code (better known as XSS) with a thoroughly audited, secure yet permissive whitelist, it will also make sure your documents are standards compliant, something only achievable with a comprehensive knowledge of W3C’s specifications.

PHP CodeSniffer

PHP CodeSniffer is a PHP5 script that tokenises and “sniffs” PHP code to detect violations of a defined set of coding standards. It is an essential development tool that ensures that your code remains clean and consistent. It can even help prevent some common semantic errors made by developers.

GeSHi

GeSHi is a generic syntax highlighter for PHP that takes any source code and highlights it in XHTML and CSS. It features case-sensitive or insensitive highlighting, auto-caps/non-caps of any keyword, an unlimited scope for styling, the use of CSS in which almost any aspect of the source can be highlighted, the use of CSS classes to massively reduce the amount of output code, function-to-URL capabilities, line numbering, and much more.


Unit Testing


PHPUnit


To make code testing viable, good tool support is needed. This is where PHPUnit comes into play. It is a member of the xUnit family of testing frameworks and provides both a framework that makes the writing of tests easy as well as the functionality to easily run the tests and analyse their results.

SimpleTest

Unit testing, mock objects and web testing framework for PHP built around test cases. If you know JUnit/JMock or some of the PHPUnit clones this will need no explanation. Includes a native web browser for testing web sites directly.

PHPSpec

PHPSpec allows you to write executable examples reflecting specifications of the desired behaviour of the source code being described. You can write code examples which are repeatable, this means you write an example and may repeat it as often as you wish to ensure the implementation code it relates to continues to abide by the example.


Debugging


PHP Debug


During both the development and deployment phases, developers require a consistent stream of diagnostic information in order to determine whether the application is working as intended. The functionality of the PHP Debug component can be used to write debug messages and measure the execution time.

dBug

dBug is the PHP version of ColdFusion’s cfdump. It outputs coloured and structured tabular variable information and has the ability to force certain types of output.


Deployment


Phing


Phing it’s a project build system based on Apache Ant. You can do anything with it that you could do with a traditional build system like GNU make, and its use of simple XML build files and extensible PHP task classes make it an easy-to-use and highly flexible build framework.

Xinc

Xinc is a continuous integration server written in PHP 5. It has built-in support for Subversion and Phing (and therefore PHPUnit), and can be easily extended to work with alternative version control or build tools.


Security


Securimage


Securimage is an open-source free PHP CAPTCHA library for generating complex images and CAPTCHA codes to protect forms from spam and abuse. It can be easily added into existing forms on your website to provide protection from spam bots. It can run on most any web server as long as you have PHP installed, and GD support within PHP.

Scavenger

Scavenger is an open source real-time vulnerability management tool. It helps you respond to vulnerability findings, track vulnerability findings, review accepted or false-positive answered vulnerabilities, and not ‘nag’ you with old vulnerabilities.

PHP Security Scanner

PHP Security Scanner is a tool written in PHP intended to search PHP code for vulnerabilities. MySQL DB stores patterns to search for as well as the results from the search. The tool can scan any directory on the file system.

PHPIDS

PHPIDS (PHP-Intrusion Detection System) is a simple to use, well structured, fast and state-of-the-art security layer for your PHP based web application. The IDS neither strips, sanitizes nor filters any malicious input, it simply recognizes when an attacker tries to break your site and reacts in exactly the way you want it to.


User Authentication


phpGACL


phpGACL is an set of functions that allows you to apply access control to arbitrary objects (web pages, databases, etc) by other arbitrary objects (users, remote hosts, etc). It offers fine-grained access control with simple management, and is very fast.


XML and PHP


SimplePie


SimplePie is a very fast and easy-to-use class, written in PHP, that puts the “simple” back into “really simple syndication”. Flexible enough to suit beginners and veterans alike, SimplePie is focused on speed, ease of use, compatibility and standards compliance.

PHP Universal Feed Generator

This package can be used to generate feeds in either RSS 1.0, RSS 2.0 or Atom formats.


Image Handling


WideImage


WideImage is an object-oriented library for image manipulation, written in PHP 5. It’s a pure-PHP library and doesn’t require any external libraries apart from the GD2 extension.


Graphs and Charts


pChart


pChart is a PHP class oriented framework designed to create aliased charts. Most of todays chart libraries have a cost, our project is intended to be free. Data can be retrieved from SQL queries, CSV files, or manually provided. Focus has been put on rendering quality introducing an aliasing algorithm to draw eye candy graphics.

JpGraph

JpGraph can be used to create numerous types of graphs either on-line or written to a file. JpGraph makes it easy to draw both “quick and dirty” graphs with a minimum of code as well as complex graphs which requires a very fine grained control. The library assigns context sensitive default values for most of the parameters which minimizes the learning curve.

PHP Google Charts API

The Google Chart API returns a PNG-format image in response to a URL. Several types of image can be generated: line, bar, and pie charts for example. For each image type you can specify attributes such as size, colors, and labels.

PHP/SWF Charts

PHP/SWF Charts is a simple, yet powerful PHP tool to create attractive web charts and graphs from dynamic data. Use PHP scripts to generate or gather the data from databases, then pass it to this tool to generate Flash (swf) charts and graphs.

Open Flash Chart

This is an object oriented library for live-manipulating Open Flash Chart.


Template Engines


Savant


Savant is a powerful but lightweight object-oriented template system for PHP. Unlike other template systems, Savant by default does not compile your templates into PHP; instead, it uses PHP itself as its template language so you don’t need to learn a new markup system. Savant has an object-oriented system of template plugins and output filters so you can add to its behaviour quickly and easily.

Smarty

Smarty is a template engine for PHP. More specifically, it facilitates a manageable way to separate application logic and content from its presentation. One of the unique aspects about Smarty is the template compiling. This means Smarty reads the template files and creates PHP scripts from them. Once they are created, they are executed from then on. Therefore there is no costly template file parsing for each request.

PHPTAL

PHPTAL is a templating engine for PHP5 that implements brilliant Zope Page Templates syntax. PHPTAL is fast thanks to compiled templates and fine-grained caching. Makes it easy to generate well-formed XML/XHTML.


Documents


TCPDF


TCPDF is a PHP class for generating PDF documents without requiring external extensions. TCPDF supports all ISO page formats and custom page formats, custom margins and units of measure, UTF-8 Unicode, RTL languages, some HTML code, barcodes, TrueTypeUnicode, TrueType, Type1 and encoding, JPEG, GIF and PNG images, graphic functions, bookmarks, JavaScript, forms, page compression, and encryption.

PHP Excel

Create Excel documents in PHP. This component provides a set of classes for the PHP programming language, which allow you to write to Excel 2007 files and read from Excel 2007 files. This project is built around Microsoft’s OpenXML standard and PHP.