36 Useful PHP Libraries for Programmers and Developers

PHP (Hypertext Preprocessor) is used as a general programming language for web development. It’s a server site scripting language that powers roughly 240 million websites. The PHP source code can be implemented with HTML code, or it can be used with various web frameworks, template engines and standalone graphical applications. Facebook, Wikipedia, WordPress are few popular websites that are built on PHP.

PHP Libraries allow programmers to take complete advantage of object oriented approach. PHP has many inbuilt library API, for example cURL. The best thing about PHP is it’s a free source where anyone can make his/her own library for others to use.
We have gathered few amazing PHP libraries which will help you do some cool stuff without putting much effort. Just import them to test and furnish your coding experience.

The aim is to introduce new and unknown stuff, that’s why the list doesn’t include popular libraries.

36. phpAES

phpAES

phpAES is a class implementation of 128, 192 and 256 bit AES encryption cipher that doesn’t require mcrypt or any other extension to be compiled into PHP. It supports different cipher mode, including Cipher Block Chaining (CBC), Electronic Codebook (ECB), Output Feedback (OFB) and Cipher Feedback (CFB).

Read: 17 Useful PHP Testing, Debugging and Optimization Tools

35. pChart

pChart

pChart helps you create pictures or anti-aliased charts directly from your web-server. The data can be displayed in the form of pie chart, bar chart or other formats. It provides object oriented coding syntax and is fully in line with the new web standards, allowing you to enhance your web 2.0 apps.

34. Faker

Faker

Faker generates fake data whenever you need. You can bootstrap your database, create XML documents, fill-in your persistence to stress test it, or anonymize data extracted from a production service.

33. PHP Text to Image

PHP Text to Image

As the name suggests, this library converts text into an image. This could be used in certain cases such as displaying phone number as an image that cannot be found programmatically. It can reduce the possibility of your phone number or email address being picked up by web crawlers and used as junk.

32. Dispatch

dispatch1

Dispatch is a tiny library that can define URL rules to better organize your website. You can match specific types of HTTP paths and requests, render displays and more. To extend its functions you can integrate it with other PHP libraries.

31. phpDocumentor

phpDocumentor

phpDocumentor allows you to generate documentation directly from your PHP source code. It gives an in-depth view of project to your customers regarding the functionality embedded within your source code. It has a flexible template system that enables you to alter the output in any way imaginable. Also, you can extract interesting information and present it in the form of graphs and reports.

30. Goutte

Goutte

Goutte is used for scraping website and extracting data, licensed under MIT license. It offers a great API to crawl websites/blogs and extract data from HTML/XML resources.

29. GoogChart

GoogChart

GoogChart is a PHP class designed for creating and maintaining dynamic charts through Google charts. It doesn’t cover whole Google charts API but makes it very simple to use it.

28. GifCreator

GifCreator

The name says it all. It’s a PHP class that generates animated GIF from multiple images. You just need to provide images and their duration, that’s it. Moreover, the dimension and transparency of output are based on the first frame.

27. dBug

dBug

dBug is the PHP version of ColdFusion’s sfdump. It displays colored and well-structured tabular variable information. Stylesheet can be edited and table can be expanded/collapsed. dBug also has the ability to force certain types of outputs. For example, you can force an array type variable to be outputted as an object variable.

26. Alice

Alice

Alice allows you to generate hundreds of fake data (fixtures) instantly for testing purpose. You can produce complex data with constraints that can be read or edit easily. It lets you control fixture ranges, optional data, object value and unique constraints.

25. PHPGeo

phpgeo

PHPGeo is a simple library for measuring distance between two coordinates with high precision. It uses Haversine and Vincenty’s formula to calculate the distance. You can integrate this with any app related to maps or locations.

24. Geocoder

Geocoder

If you are planning to develop any geo aware application then you should take a look at Geocoder. It’s an extensible PHP library split into 2 parts: Provider and HttpAdapter. It also offers an abstraction layer for geocoding manipulation.

23. Purl

purl

Purl is an Object Oriented library for URL manipulation. You can create URL instances easily and chain methods together after creating the URL. The library supports path, fragment and query manipulation.

22. Snappy

Snappy

Snappy lets you generate snapshot, thumbnail and PDF from a URL or HTML page. This library uses the webkit based on wkhtmltoimage and wkhtmltopdf available for Windows, OSX and Linux.

21. ShellWrap

shellwrap

ShellWrap is a library that allows you to use powerful Unix/Linux tools within PHP. You can easily pipe commands together, use simple syntax and capture error as PHP exception. All arguments are properly escaped and paths to binaries are resolved automatically.

20. Unirest

unirest

Unirest is a collection of lightweight HTTP libraries which is ideal for numerous applications. Make PUT, DELETE, PATCH, GET and POST requests. It supports gzip, basic authentication, file upload, form parameters and custom body entities like timeout and default header for each request.

19. IniScan

iniScan

IniScan is a tool designed for scanning PHP INI files for security. It searches for common security errors and report back results. You can also request the scan files only that are above threshold.

18. PHP Captcha

PHP CAPTCHA

PHP Captcha can be used for generating audio and visual CAPTCHAs. It supports character rotation, font size selection, character set selection, random or custom background, optional display text and character shadow.

17. Ratchet

Ratchet

Ratchet is a loosely coupled PHP library that offers various tools to develop real time, bidirectional applications between servers and clients over WebSockets. There are many components available to easily add functionality. You can write your own chat application within minutes.

16. TCPDF

tcpdf

TCPDF is a PHP class (open source) for generating PDF documents. It supports all standard page formats, custom page format, UTF-8 unicode, PDF annotation including links, text rendering mode, font subsetting, text stretching & spacing, page compression, TrueTypeUnicode and OpenTypeUnicode.

15. Munee

Munee

Munee library can be used to compile CoffieScript, LESS, SCSS, resize image, minify JS & CSS, and cache assets on both server and client side, without changing the assets in template. Overall, this is a good option for achieving lightning fast requests and saving your bandwidth.

14. HTML Purifier

HTML Purifier

HTML purifier is an HTML filtering library developed for removing all malicious code. It can be used for protecting your code from XSS attacks. This library uses combination of robust whitelists, aggressive parsing and makes sure that the resulting markup is standards compliant.

13. Detector

detector

Detector is an open source library for detecting numerous information of users/visitors. It can help you to build accurate web analytics. It displays user agent, device type, browser used along with its HTML and CSS capabilities. It also tells whether the data is fetched by human or robot bot.

12. Whoops

Whoops

Whoops helps you to deal with errors and exception in a less painful way. It provides a great error interface that tells you details of errors & exception present in the code (with line highlight). Moreover, it supports JSON, XML, SOAP and AJAX.

11. Gaufrette

Gaufrette

Gaufrette provides a filesystem abstraction layer which permits you to develop your application without the need to know where and how media files will be stored. It also allows you to update file locations without altering the source code apart from the definition of filesystem.

10. Imagine

 

Imagine is a rich object oriented library for image manipulation. It can handle various operations like open, save, create, resize, watermark, create collage, apply image reflection filter etc. Imagine’s coordinate system allows you to draw different shapes on images. The color class helps you to generate RGB value to apply colors to images. It also supports layer and animated GIF manipulation.

9. Idiorm

Idiorm

Idiorm is a lightweight object relational mapper and fluent query builder for PHP5, which is built on top of PDO. With it, you don’t need to write long and routine SQL. Moreover, it requires no XML configuration, no model classes and no code generation.

8. phpFastCache

phpFastCache

As the name suggests, it is the high performance object caching system. It is designed to speed up dynamic web applications by reducing database load. It supports multiple caching methods (period can be defined explicitly) including memcache, memcached, files, wincache, mpdo, pdo and apc. You don’t have to write your PHP caching class again whenever you change servers.

7. JpGraph

jpgraph

JpGraph is a PHP library for creating object oriented graphs. It has over 200 built in country flag, 400 named colors and supports advanced Gantt chart, multiple Y-axis, alpha blending and internal caching (with timeout). This library allows you to create line, bar, pie, map, stock, polar, radar, balloon and contour charts of any size.

Read: 20+ Useful Online Tools to Create Charts and Graphs

6. SEOstats

SEOstats

SEOstats is a powerful open source library that provides various SEO related metrics such as detailed backlink analysis, page authority, website trends, keyword, traffic stats, Alexa rank and much more. It gathers data from Alexa, Google, Moz, open site explorer, SEMRush, Facebook and Twitter.

5. PHP Parser

PHP parser

PHP parser written in PHP to simplify static code analysis and manipulation. It converts the PHP source code into an abstract syntax tree. The syntax tree helps you to easily analyze the code issues and errors. Moreover, you can turn a syntax tree back into PHP code. The example is shown in the image where the white portion represents simple code and black portion contains generated syntax tree.

Read: 20+ Puzzle Websites to Sharpen Your Coding Skills

4. PHP Error

PHP Error

PHP Error library is used to transform default error messages into better ones with full syntax highlighting and code snippet. It fixes some error messages that are just plain wrong and works for AJAX too. Moreover, you can manually turn it off or on, run a specific section without error reporting and ignore selected files.

3. PHP-CPP

PHP-CPP

PHP-CPP is a C++ library which can be used to develop PHP extensions. It is packed with easy to use and well documented classes for building native extensions in PHP. This can speed up your program because code written in C++ executes faster than PHP.

Read: What’s New in PHP 7: Things You Should Know

2. Eden

Eden

Eden is a set of reusable components that works with almost all PHP framework and CMS. It covers components for autoloading, caching, file systems, web services, templating, i18n, payment gateway, shipping and cloud technologies. It works with all major web services including Google, Facebook, Yahoo, PayPal, Tumblr, foursquare and Amazon web services.

1. Locust

Locust

Recommended: 30+ Helpful Cheat Sheets for Programmers

Locust is easy to use, user load testing tool. It can be used for figuring out how many concurrent users a system can handle. It allows you to write user test scenarios in Python. Locust has a great interface (HTML+JS) that displays relevant text details in real time.

Written by
Varun Kumar

I am a professional technology and business research analyst with more than a decade of experience in the field. My main areas of expertise include software technologies, business strategies, competitive analysis, and staying up-to-date with market trends.

I hold a Master's degree in computer science from GGSIPU University. If you'd like to learn more about my latest projects and insights, please don't hesitate to reach out to me via email at [email protected].

View all articles
Leave a reply