PHP Libraries I Use On Every Project

The PHP community on GitHub is also one of the biggest and most active, with new awesome projects coming out constantly.Since last month, I’ve been looking for good PHP libraries to use in my PHP projects (Playlist Converter).

Here are my picks for the 5 most useful and interesting open-source PHP libraries that you should check out. (Last Update: July 18, 2017)

P.S: If I missed any good PHP library, feel free to share it in the comments ­čÖé


Monolog

With Monolog you can create advanced logging systems by sending your logs to files, sockets, databases, inboxes databases and various web services. The library has over 50 handlers for various utilities and can be integrated into frameworks such as Laravel 4 & 5, Lumen, Symfony2, and Slim.

Installation

You can install the latest version with

$ composer require monolog/monolog

Basic Usage

 

Whoops

Whoops!
PHP errors for cool kids

Whoops greatly improves the debugging experience in PHP by displaying a detailed error page when something breaks in an app. This error page gives us the full stack trace showing the specific files and snippets of code that caused the exception, all syntax-highlighted and colorful. The Laravel framework comes with Whoops built-in.

Installation

You can install the latest version with

$ composer require filp/whoops

Basic Usage

Guzzle

Guzzle is one of the best HTTP clients out there. It can handle almost any HTTP task that you throw at it: synchronous and asynchronous requests, HTTP cookies, streaming of large uploads and downloads. Working with Guzzle is really easy and the docs are well written with lots of examples and detailed explanations.

Installation

You can install the latest version with

$ composer require guzzlehttp/guzzle

Basic Usage

Twig

Templating engine with a very clean “mustache” syntax that makes markup shorter and easier to write. Twig offers everything you would expect from a modern templating library: variable escaping, loops, if/else blocks, as well as a secure sandbox mode for verifying template code.

Installation

You can install the latest version with

$ composer require "twig/twig:^2.0"

Basic Usage

PHP dotenv

A really handy PHP library that allows you to load environment variables from┬á.env┬áto┬ágetenv(),$_ENVand$_SERVERautomagically. It’s┬áthe PHP version of the original┬áRuby dotenv.

Find out more here.

Installation

You can install the latest version with

$ composer require vlucas/phpdotenv

Basic Usage