PHP IconPHP, being the most popular scripting language, has lots of documentation, tutorials and resources about itself.

And, as a feature-rich language, it is possible to accomplish many tasks by default from handling e-mails to images, PDFs to database connections, etc.

However, there are high-quality and free PHP classes and libraries which helps you get more like:

  • good looking charts
  • form validation
  • parsing feeds
  • better image or database handling
  • and more.

Here is a collection 40+ totally free PHP classes and libraries that every PHP developer would love to bookmark:

Free PHP Classes And Libraries

Content


BackPress

A complete library, that grew from WordPress, which offers the most common tasks for creating web applications like user management, HTTP transactions, logging, formatting and more.

PHP User Class

The class aims to ease the handling of user management tasks like registration, login, logout, etc. for PHP-MySQL applications.

phpSEO

Do you want to automate the process of generating keywords or meta tags from the content? This is what  phpSEO does.

It can create any desired number of keywords from a given string or URL, generate a description and does all with not using any banned words you define.

PHP Typography

A PHP class for improving web typography with features like hyphenation, spacing control, wrapping of long text, character replacement for items like ordinal suffixes, trademark or math symbols and more.

Tag Cloud

The class creates tag clouds from a given array of items where each tag can have its own color, URL and style.

 

Handling Documents


PHPExcel

A set of PHP classes for writing to and reading from different file formats, like Excel, PDF and HTML.

It supports many MS Excel features like adding worksheets to a spreadsheet, inserting data and formulas to cells, calculating formulas and much more.

PHPPowerpoint

Set of classes for reading and writing to Powerpoint documents and supports adding slides, rotating images and more.

TCPDF

A complete PHP PDF class with features like custom page formats or margins, support for images and automatic page header/footer management.

It can also handle document encryption, PDF annotations, bookmarks and table of content.

FPDF

A PDF generator class with flexible page format and margins support. It can automatically arrange page breaks and can insert images into documents.

ZipStream

Compared to many PHP zipping libraries, this class does not require  "writable temp directory" and can generate + start the download after the client timeouts (good for huge files).

 

File Uploads, Images & Colors


EasyUp

A clean and simple PHP file upload class which can also delete the file uploaded and get the size + filename of it

class.upload.php

A PHP class for manipulating and uploading image files on-the-fly.

It can convert, resize and work on uploaded images in many ways: add labels, watermarks and reflections.

Image Resizing Made Easy with PHP

A PHP class which can open, resize (smart resizing with no distortion) and save a number of images in multiple formats.

It is explained very well with a detailed tutorial.

WideImage

A feature-rich PHP library for image manipulations by providing a simple way to loading and saving images from/to files, strings, database, uploads and URL addresses.

You can apply filters, get channels, merge, resize, crop or rotate images using the library.

Asido

A powerful PHP image processor with features like resize, rotate, watermak, frame, convert, rotate, crop and much more.

xColor

An impressive class to make various calculations on colors like converting between formats (HEX,RGB,HSL/HSV), getting the end color when a color is added to or removed from a pallette and more.

 

E-mail


PHPMailer

One of the most popular PHP e-mail classes around with features like multiple receivers, embedded images, HTML or plain text,  SMTP authentication and much more.

There are also other projects by the same author for form-to-emails, mailing list and bounce management.

Swift Mailer

The library can send emails using SMTP, sendmail, postfix or a custom method.

It supports SMTP authentication, handling attachments and much more. A great thing is, it is extendable with plugins (there are already ones for antiflood, throttling and logging).

 

Forms


PHP Validation

A set of rules for instantly adding server-side validation to our forms.

The rules include "required, length, e-mail, date, numeric, string and much more. Also, you can add custom regular expressions.

VDaemon

It can check user input by comparing to the rules defined and, if necessary, display errors.

The library has methods like required, e-mail, zip codes, IP address, date, time, integer, string and much more.

Securimage (Captcha)

This PHP captcha class can create complex images or captcha codes and can be easily added into existing forms.

The codes generated can be in custom length, font and use backgrounds. Also, a Flash button can play the mp3 of the image.

 

Database & Backup


Crystal

This PHP database wrapper offers a human-readable SQL and makes CRUD operations so easy.

It also handles data validation and database manipulation (creating databases, tables, etc.)

ADOdb

A database abstraction library for PHP which supports almost any database (MySQL, PostgreSQL, Interbase, Firebird, Informix, Oracle, MSSQL, Access, SQLite, etc.).

It is fast, supports advanced features like SQL code generation, database-backed sessions and more.

Doctrine

It offers a powerful database abstraction layer with many features for database schema introspection, schema management and PDO abstraction.

Also an object relational mapper (ORM) that sits on top of a powerful database abstraction layer (DBAL) which can write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL) providing developers a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.

ezSQL

This PHP database class makes using popular databases a breeze.ezSQL with detailed debug functions to find outwhat’s going on in your SQL code.

NYT_Transformer

A free PHP class that is developed by the NY Times development team.

It can convert various input types to many other types like Oracle to MySQL or from a database to a flat file.

PHPMYExport (Database Backup)

The class enables users to backup and restore databases (MySQL, PostgreSQL, MSSQL, etc.) from a web-based interface.

BigDump (Staggered MYSQL Database Importer)

Taking backups of large MySQL databases via scripting (like from phpMyAdmin) is usually an issue as backups may not be completed because of the PHP timeout value.

This class backups databases with small portions every time and continues from where it had stopped.

Database CSV Class

It extracts data from a database and generates a .CSV file with it.

The class can be set to prompt you to download the generated file or save it in a folder (or both).

 

Charts


pChart

A PHP charts class for displaying the data beautifully.

It supports line- bar and pie charts in both 2D and 3D.

JpGraph

An impressive graphing library with support for lots of chart types. It generates web-friendly, small images, can draw 200+ flags with a built-in function and has an internal caching.

Sparkline PHP Graphing Library

Sometimes charts are not what we need and displaying the data within a paragraph, just like a word, works better.

This library exactly does that. Using it, you can create tiny graphics to present your data.

 

Feeds


SimplePie

It is the ultimate PHP class for fetching, caching, parsing feeds with lots of integrated methods from social bookmarking integration to one-click subscriptions for popular feed services.

Last RSS

A simple yet powerful RSS parser with features like caching, limiting items and date formatting.

Magpie RSS

A modular and bandwidth-friendly (transparent GZIP-encoding) RSS parser with an integrated caching system.

 

3rd Party Services


Short URL Class

There are many sort URL services and it is possible that you may not want to stick to only one.

This class can shorten URLs with TinyURL, Is.gd, Hex.io, Tr.im & Bit.ly API.

Google Translation PHP wrapper

Google Translate has a limit of translating 5000 words at once. This smart PHP class can translate unlimited numbe of words by splitting the input, sending the queries one-by-one and merging the results at the end.

GAPI – Google Analytics PHP Interface

An easy to use PHP class for getting Google Analytics data.

To view a working demo, check out the tutorial I had published using the class: FeedCount-Like Google Analytics Counter.

PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO)

If you want to use these providers at the same time in a project, the library offers an API which enables you to handle all providers in the same way.

phpFlickr

It is a PHP wrapper for the Flickr API which returns a friendly array of data to make development easier.

The class has support for uploading photos, getting albums + images inside them and caching.

Twitter with OAuth class

It makes communicating with the Twitter API (using OAuth) easier and supports almost every feature of the API.

PHPWeatherLib

A lightweight weather conditions library that pulls the weather data from the NOAA's public XML weather feeds.

It can get the temperature (in multiple formats), wind, humidity and an icon for the weather situation.

 

Others


HTML Purifier

A complete PHP HTML filter library that can remove malicious code (with a whitelist) and also makes sure the documents are standards-compliant.

PHP DNS Query

A set of PHP classes that provides a direct domain name service API.

It offers direct to-server queries, the ability to process the response in detail but still with a simple interface for the developer.

hKit (Microformats Parser)

A simple class for extracting common microformats from a page (currently supports hCard).

XMPPHP

It enables you to connect to any XMPP 1.0 server (like Google Talk), send messages and supports SSL/TLS connections.

WebResourcesDepot Feed