30+ Useful PHP Libraries – Spring 2017
This week we have for you a collection of high-quality PHP libraries that have caught our eye in the last couple of months.
We’ve tried our best to include projects that are active, well documented, and will have a realistic shot at finding a place in your developer’s workbelt.
If we’ve haven’t included your favorite new library, feel free to share it in the comments 🙂
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.
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.
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.
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.
A 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).