50+ Extremely Useful PHP Classes & Libraries


In the past, we’ve discussed several methods you can use to reduce hand coding by use code generators or even APIs. Today, we will highlight some useful PHP classes, libraries and components that will help you roll out and enhance basic functions of your applications while focusing more on writing new functionality.

Database Class

ADOdb – Database Abstraction Library
ADOdb is a database abstraction library for PHP and supports a wide range of databases including MySQL, PostgreSQL,Oracle, MS SQL,SQLite, etc. It is one of the most popular and fast open source database abstraction library. It provides extensive portability features with a short learning curve.

PHP DB Class – MySQL Database Class
PHP DB Class is a PHP class that facilitates PHP/MySQL development. It propose convenient methods and an easy way to access a database by reducing the amount of code you should write. It also provides debugging facilities: you can display the request and the resulting table by just adding a parameter to the methods of this class. Queries are automatically debugged when there is an error.

CatchMyFame Pagination Class
Paginator.class.php allows you to easily generate page numbers and restrict database results without having to create complex pagination code of your own.  It supports previous/next links generation, jump to page dropdown and has the ability to select number of records per page.

PHPillow – Wrapper for CouchDB
PHPillow is an object orientated wrapper for CouchDB. Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API. This class works with PHP 5.2

sqlCache – Caching SQL Database Results
sqlCache is a library that caches the results of SQL database query results in files. The idea is to increase database application performance by avoided to access databases to retrieve the results of queries being executed repeatedly.

IAM Backup – MySQL Database backup and restore
IAM Backup is a MySQL database backup and restore class. It support gzip-compressed files for improved performance.

PHP DataGrid
PHP DataGrid script is a simple, innovative and powerful tool for generating data-bound grid control. It was specially designed for web developers. The PHP DataGrid is excellent for all PHP database-driven web sites and online-based data administration.

Security

PHP CAPTCHA – Visual and Audio PHP CAPTCHA Generation Class
PhpCaptcha is a library for generating visual and audio CAPTCHAs (completely automated public Turing test to tell computers and humans apart). The library requires PHP 4 compiled with GD 1 or 2 (Image Generation) and FreeType text support

User Input Sanitization Class
A simple class that makes sure that your user inputted data is clean. It does so by checking variables $_GET, $_POST, $_REQUEST, $_COOKIE and allows only known variables and make sure that they contain the right type of data.

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.

Simply PHP/MySQL authentication class
A simple authentication class that is secure and easy to use. It features login form, password recovery, md5 encryption and page password protection

phpAES – Encryption Class
phpAES is a class implementation of 128, 192, and 256 bit AES encryption cipher. It does not require the mcrypt extension, or any other extention be compiled into PHP, it uses 100% PHP, and is fully FIPS 197 Compliant.

Image Handling

PHP Thumbnailer
PHP Thumb is a light-weight image manipulation library aimed at thumbnail generation. It features the ability to resize by width, height, and percentage, create custom crops, or square crops from the center, and rotate the image.

WideImage
WideImage is an object-oriented library for image manipulation, written in/for PHP 5∞. It’s a pure-PHP library and doesn’t require any external libraries apart from the GD2 extension. The library focuses on ease of use of the most common image operations.

PHP Text to Image
This class allows you to convert a string of text into an image. This has some simple uses such as displaying text such as email address that cannot be programmatically found. This can help to reduce the possibility of your email address being picked up by web crawlers and used for junk mail.

PHP Image Upload Class
This PHP5 class makes it easy to allow users to upload images via a file input in a form. All user messages are defined outside of the class to facilitate localization using gettext or similar.

PHP Image Watermark Class
This class will take any image and automatically add a watermark before it is delivered from the server to the person’s browser.

Document Handling

TCPDF – Generate PDF documents
TCPDF is a class for generating PDF documents. TCPDF is currently the only PHP-based library that includes complete support for UTF-8 Unicode and Right-To-Left languages, including the Bidirectional algorithm.

parseCSV
parseCSV is an easy to use PHP class to read and write CSV data properly. It has a few advanced features which help make your life easier when dealing with CSV data. It supports enclosed values, enclosed commas, double quotes and new lines.

PHP Export XLS Class
A lightweight, simple and fast PHP Class which exports array data to Excel’s .XLS format.  It support features such as setting spreadsheet meta data (author, title, description, …), multiple worksheets, different fonts and font styles, cell borders, fills, gradients, adding images to your spreadsheet, etc.

php Text Cleaner
Copying and pasting text from a Word document can lead to multiple character set inconsistencies both in databases and when output to a web page. This PHP class that prepares MS Word formatted text for placing within HTML.

ZipStream
ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.

PHP Powerpoint Class
A set of classes for the PHP programming language, which allow you to write to and read from different file formats, like PowerPoint 2007. This project is built around Microsoft’s OpenXML standard and PHP.

Charts and Graphs

XML/SWF Charts
XML/SWF Charts is a simple, yet powerful tool to create attractive charts and graphs from XML data. The XML source can be prepared manually, or generated dynamically using any scripting language (PHP, ASP, CFML, Perl, etc.)

GoogChart
GoogChart is a PHP class with one goal, make it super simple to create and maintain dynamic charts through Google Charts.

jpGraph
JpGraph is an Object-Oriented Graph creating library for PHP >= 5.1 The library is completely written in PHP and ready to be used in any PHP scripts

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.

Development

Mobile_Detect
Mobile_Detect is a simple PHP class for easy detection of the most popular mobile devices platforms: Android, Blackberry, Opera Mini, Palm, Windows Mobile, as well as generic ones.

Country from IP
Country from IP is a PHP geolocation class that can determining country of the network of a given IP address looking up a simple text database file. It can also determine the path of an image file of the flag of a given country.

TypeFriendly – User Manual Builder
TypeFriendly is a HTML book and user manual builder. It is written in PHP5 and is based on a very simple and easy-in-use Markdown syntax.

PHP Code Beautifier
A PHP code formatter class that strips all lines and leading spaces from your source code and then adds spaces and new lines only where is needed. You can modify the beautifier class code to suit your taste.

phpDocumentor
An auto-documentation tool for PHP that creates professional documentation from your 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.

phpUnit
PHPUnit provides both a 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
SimpleTest PHP unit tester is a PHP unit test and web test framework. It has support for SSL, forms, frames, proxies and basic authentication. The idea is that common but fiddly PHP tasks, such as logging into a site, can be tested easily.

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.

phpRack
phpRack is a light framework for automation of integration tests. By integration tests we mean software modules that should be executed in the production environment, in order to validate that said environment is configured as expected.

Performance

jshrink
JShrink is a php class that minifies javascript so that it can be delivered to the client quicker. This code can be used by any product looking to minify their js on the fly.

PHP-Cache-Kit

PHP-Cache-Kit is a slim little PHP class which allow you to quickly and easily implement module-level caching into your PHP projects. It can help to speed up your site’s load time.

CSS Compressor
This php class library can be used to compress css files of your page before output. It can merge multiple css files into one to reduce number of http request. It will remove all whitespace and comments from the merged css file to reduce file size.

Search Engine Optimization

seostats
SEOstats is a simple yet powerfull PHP class to get SEO Statistics from website tracking and statistic services such as alexa, majesticseo, google and yahoo.

PHP XML Sitemap generator
A PHP classe which allows you to dynamically and programmatically create standards based XML sitemaps for inclusion into Google and other search engines.

phpSEO
A simple class that will allow you to generate meta keywords and description automatically and dynamically – it does so by analyzing your content.

Forms & Email

Swift Mailer
Swift Mailer integrates into any web app written in PHP 5, offering a flexible and elegant object-oriented approach to sending emails with a multitude of features. It can send emails using SMTP, sendmail, postfix or a custom Transport agent.

Secure PHP Form Mailer Script
This script has a wide range of features including: an easy to use dynamic form generation system (any number of fields, in any order), multiple recipients, multiple file attachments, optional auto reply feature, an image verification system and numerous security features.

php-form-builder-class
An Object-oriented php class for building HTML forms. It eliminate the grunt/repetitive work of writing the html and javascript validation when building forms.

PHP Form Validation Script
The generic PHP form validator makes it very easy to add validations to your form. You can associate a set of validation descriptors for each input field in the form.

Receive Email Class
his class can be used to retrieve and parse e-mail messages from a POP3 or IMAP using the PHP IMAP extension. It can connect to a mail server, retrieve the total number of messages in a mailbox, retrieve the headers, body and attachment files, etc.

XML and RSS

SimplePie
SimplePie is a super-fast, easy-to-use, RSS and Atom parser written in PHP that puts the ‘simple’ back into ‘really simple syndication’.

PHP Universal Feed Generator
PHP Universal Feed Generator is a class that allows you generates both ATOM and RSS feeds from your database records. It support all possible feed elements and you can easily define channel and feed items.

XML-Simple
XML-Simple is a PHP class library that parses XML data. It does so by reading the XML nodes and storing the values in an array.

For more PHP classes and libraries, please visit our PHP Classes category
Related Posts:

3 Responses to “50+ Extremely Useful PHP Classes & Libraries”

  1. Adrian Says:

    Nice article and useful libs. Thanks a lot.

  2. Shabu Anower Says:

    Found a superb class, seostats. It’ll save my development time for next project.

    Thanks for your effort.

  3. Stephan Schmitz Says:

    Thanks to the author and to Shabu, classifying my PHP class SEOStats as “extremly useful” and “superb”. :) Greatful to know, as this is the first ever feedback i got.

    Just to let you know: I made a few improvements on the class during the last days and posted an updated version at the projectpage http://code.google.com/p/seostats/

    Kind regards,
    Stephan

Leave a Comment