10+ extremely useful PHP classes

by Jean. 55 Comments -

One of the numerous good points of the PHP programming language is its extensibility. In this article, I’m going to show you 10+ extremely useful PHP classes that will definitely make your developer life easier.

PHP PSD Reader

A few weeks ago, I wrote an article about this PHP which allow you to display any Adobe PSD file on screen. Very usefull to create preview of PSDs designed for clients, for example.

Browser detect

One of the most common (and boring) problem for front-end developers is definitely cross-browser compatibility. This PHP class will detect almost all browsers and simplify your cross-browser work.


Remember those days without spam? If your website gets spammed in any ways, Akismet can probably help you. When a new comment, trackback, or pingback comes to your site it is submitted to the Akismet web service which runs hundreds of tests on the comment and returns a thumbs up or thumbs down.


The large majority of websites and web apps are using databases to store all kinds of data. ADOdb is a database abstraction library for PHP, supporting MySQL, PostgreSQL, Interbase, Firebird, Oracle, MS SQL and more. ADOdb is quite easy to learn and have lots of nice features as such as extensive portability support, speed and BSD licencing.

HTML Purifier

As it name tells, HTML Purifier is a PHP class created to help you writing a better code. HTML Purifier can remove malicious code and make sure your code is standard-compliant. A great tool for all developers.

Google charts API

Charts are very useful and highly asked by clients, but they can be a lot of work. I remember some years ago when a friend of mine had to create charts using Photoshop every week for one of his clients. Well, this time is gone for good.
With the Google charts API, a simple chart can be created and displayed on screen using as little as 4 lines of code.


pChart is another chart class, and it is as good as Google charts API. Data can be easily retrieved from SQL queries, CSV files, or manually provided.

PHP Excel

Excel documents are highly popular in the corporate world. Considering that fact, there’s a strong chance that one of your clients asks for you to create excel files in PHP someday.
Happilly, the PHP Excel engine allow you to easily create and manipulate lots of different files, as such as Excel 2007, Open XML, or PDF.

Country from IP

Some websites are able to detect your location and automatically display information related with your language. How do they do that? Quite simple, they use your IP adress to find your location. The Country from IP class is easy to use and will allow you to get the country a specific IP is from.

Cache Manager

If you’re working on a high traffic site, there’s not doubt you’ll need to cache files in order to improve performance. This will be very easy an simple to do, using this very handy class. A defifinitive must-have, in my opinion.


As I know many of you have a WordPress blog, I just can’t finish this article without a great tool for our favorite blogging engine.
WPGet is a PHP class which allow you to easily get infos from a WordPress 2.X database. In other words, it allows you to get posts, comments, etc from a WordPress blog, on a non-WordPress site. Great, isn’t it?

Comments (55) - Leave yours

  1. Jani Hartikainen said:

    Some good ones there, but I have to disagree with Browser Detect and ADOdb…

    I can not see where browser detect is useful, except for stats collection. If you need to fix your JavaScript code or whatever for specific browsers, a much better approach is capability detection.

    ADOdb is quite pointless – you can use PDO, which is built-in in PHP5, to do quite the same. I think ADOdb’s pro is that it works with PHP4 (iirc), but I would not really want to use it just because of that.

    Finally, the functionality provided by WPGet should be built into WordPress in my opinion – but it’s poorly built so I guess you’ll need the library until they get their act together.

  2. Stefan said:

    I highly recommend people to use Akismet. One of my niche sites were so attacked by spam that my main traffic actually was people searching for different combinations of sex and similar words.

  3. Chris said:

    I would like to mention:
    * MDB2 as abstraction layer DBMS management (PEAR class);
    * FirePHP/FireBug (PEAR class);

    PHPExcel it’s good for not too much data: I tried it on 10k records and PHP goes in timeout. It consume also too much memory IMHO.

  4. Daniel said:

    Oh no, don’t use php classes dot org!
    i signed up there a long time ago and now i get newsletters at least twice a week and the unsubscribe link has no effect at all here.
    well actually the newsletter is a list of the latest php-classes and starts somewhere at page 3 of the email, after you scrolled past all the advertisements.
    try to find a working account on bugmenot or signup with your 2nd email address because they will send you spam!

  5. Binary Soldier said:

    Great read.

    The article on Google charts API was really well written and I had some charts up and running in minutes. I’m going to try and create a chart generator I think.

    Many thanks!

  6. Matthew Bonner said:

    ADOdb is full of issues and is poorly written. You are better of using the PDO extension in PHP as it is faster, more complete and has less issues.

    The Country IP tool should not be used to block visitors from a website as IP addresses can be spoofed and the IP addresses are not entirely accurate, as some UK IP addresses report that the visitor is in America and this various throughout the database.

    htmlLawed is much better than HTML Purifier

    Browser detect can be useful for backwards compatibility but with limited scenarios, although is better for logging visitor information.

    I have not used the other downloads mentioned so am not going to comment on them.

  7. John S said:

    Very useful list, thanks!

    I found this PHP class pretty useful recently too. http://github.com/Wixel/GUMP

    Powerful form validation that was easy to implement in my app

Leave a Reply

Your email address will not be published. Required fields are marked *

Please respect the following rules: No advertising, no spam, no keyword in name field. Thank you!