As a developer who does a lot of work with PHP, I am always looking for apps, libraries, or just plain old pieces of code to save development time while adding useful functionality to my applications.
I’ve tested, customized and integrated dozens of open source PHP apps/libraries into my projects over the years, and here are 5 of the best I’ve found. You will see that they cover a fairly wide range of purpose and function.
These libraries can typically be integrated with PHP based CMS (eg. WordPress, Drupal, etc), or can be integrated to stand alone, PHP based sites.
1) Dynamic PHP image thumbnails – PHPThumb
PHPThumb creates thumbnails from images (JPEG, PNG, GIF, BMP, etc) on the fly. The output size is configurable (can be larger or smaller than the source), and the source may be the entire image or only a portion of the original image.
The main benefit to PHPThumb, to me, is that you only need store a single instance of an image on the server, and can dynamically serve variants of that image at a specified file size and quality. And it works very well.
Other image processing features include:
- Dynamic watermarking and/or text overlay
- Caching for less server load. Mulitple sizes of any source image can be cached seperately. Thumbnails are automatically updated when (local) source image is modified.
- Embedded EXIF thumbnails (if available) can be extracted as-is, or used as the source image for thumbnailing if the real source image would take more memory than PHP has available.
- Images can be rotated, either by an arbitary angle or auto-rotated to either portrait or landscape.
- Images can be cropped, either by a specified number of pixels or by a percentage of original image.
- Output is antialiased into the alpha channel where appropriate when PNG output is selected.
- Quality can be auto-adjusted to fit a certain output byte size.
- Other filters: Alpha channel mask from mask file, Auto Contrast / Levels, Blur, Brightness, Contrast, Drop shadow, Flip Horizontal / Vertical, and more
2) Easy PHP form validation – vDaemon
VDaemon is a PHP library that grants an easy-to-use but powerful way to check user input for errors, and, if necessary, display messages to the user. VDaemon can perform wide range of validation tasks. It includes mandatory fields validation, validation for properly formatted value (currently supported types are e-mail address, zip codes for US, Canada and UK, US phone number, IP address, date and time in various formats, integer and floaf numbers, currency), comparing entered value to the predefined value or to another form element value, validating against regular expression pattern and more. vDaemon allows combining validation rules into logical expressions of any complexity. It gives possibility to create a conditional validation. Incorporation of VDaemon validation into existing web sites is very easy. vDaemon was once offered for free, however it has now moved to a pay (although low-cost) license.
3) Automatic MySQL database admin system generation – phpmyedit
How many times have you hand coded a MySQL table editor in PHP? phpMyEdit provides an instant table editor buy (nearly) automatically generating PHP code for displaying/editing MySQL tables in a web browser. All you need to do is provide table name(s) and database access credientials, and phpMyEdit does the rest.
It includes a huge set of table manipulation functions (record addition, change, view, copy, and removal), table sorting, filtering, table lookups, and more. The output is highly customizable, and there is a very good support forum containing answers to pretty much any questions I’ve had during implementation.
4) Integrate Google Maps with PHP – GoogleMapAPI
GoogleMapAPI is a library used for creating google maps using the Google Map public API. Features include multiple map markers, customizable icons, map directions built into info window, and sidebar generation.
5) PDF generation with PHP – fpdf
FPDF is a PHP class which allows to generate PDF files with pure PHP (eg. without using the PDFlib library). Here is a list of its main features:
- Choice of measure unit, page format and margins
- Page header and footer management
- Automatic page breaks
- Automatic line breaks and text justification
- Image support (JPEG and PNG)
- TrueType, Type1 and encoding support
- Page compression
I have used fpdf in billing and invoicing systems, and for generating report output from various PHP applications.
I hope these libraries are helpful to you and save you as much development time as they have for me.