Hey, let me introduce you some of the libraries & tools I’ve been using in many PHP projects running in production.

I’m used to build my own framework by picking up libs in the below list each time I start a new PHP project. But to be honest, I must admit that I still use a micro-framework for basic HTTP stuff: Slim.

πŸ“ I use no ORM and I mainly build backend apps with Web APIs.

Libraries

1. Slim Framework

slim

πŸ™‹ Purpose: Micro-Framework intended to build Web APIs
🌠 GitHub stars: 9,475
πŸ”— URL: slimphp/sliim

2. Slim Framework CSRF protection middleware

πŸ™‹ Purpose: Protect your GUI pages with a CSRF token
🌠 GitHub stars: 201
πŸ”— URL: slimphp/csrf

3. Slim Framework Flash Messages

πŸ™‹ Purpose: This enables you to define transient messages that persist only from the current request to the next request
🌠 GitHub stars: 104
πŸ”— URL: slimphp/flash

4. Twig

twig

πŸ™‹ Purpose: A very popular template engine that integrates well with Slim (slimphp/twig-view)
🌠 GitHub stars: 5,705
πŸ”— URL: twigphp/twig

5. Monolog

πŸ™‹ Purpose: Sends your logs to files, sockets, inboxes, databases and various web services
🌠 GitHub stars: 13,388
πŸ”— URL: seldaek/monolog

6. Zend ACL permissions

πŸ™‹ Purpose: Provides a lightweight and flexible access control list (ACL) implementation for privileges management
🌠 GitHub stars: 55
πŸ”— URL: zendframework/zend-permissions-acl

7. Guzzle

πŸ™‹ Purpose: Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services
🌠 GitHub stars: 15,355
πŸ”— URL: guzzlehttp/guzzle

8. PDO

πŸ™‹ Purpose: PHP extension to build and execute secured SQL prepared statements
πŸ”— URL: PDO

9. Zend XML-RPC

πŸ™‹ Purpose: Provides support for both consuming remote XML-RPC services and building new XML-RPC servers
🌠 GitHub stars: 14
πŸ”— URL: zendframework/zend-xmlrpc

10. PHPMailer

πŸ™‹ Purpose: A full-featured email creation and transfer class for PHP
🌠 GitHub stars: 12,422
πŸ”— URL: phpmailer/phpmailer

11. Firebase / PHP-JWT

πŸ™‹ Purpose: A simple library to encode and decode JSON Web Tokens (JWT) in PHP, conforming to RFC 7519
🌠 GitHub stars: 4,574
πŸ”— URL: firebase/php-jwt

12. Hassankhan / Config

πŸ™‹ Purpose: Config is a lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files
🌠 GitHub stars: 749
πŸ”— URL: hassankhan/config

Tools

As a PHP craftsman, the tools below are mandatory in my toolkit. Most of them (except shellcheck) are installable through composer, which allows you to add them as dev dependencies to your project’s composer.json.

1. Composer

composer

πŸ™‹ Purpose: Essential PHP dependency manager, and much more
🌠 GitHub stars: 18,049
πŸ”— URL: Composer

2. PHPUnit

phpunit

πŸ™‹ Purpose: Awesome unit tests framework with mocking features
🌠 GitHub stars: 12,785
πŸ”— URL: PHPUnit

3. PHP Code Sniffer

πŸ™‹ Purpose: Static analysis tool to detect & fix coding standard violations
🌠 GitHub stars: 5,915
πŸ”— URL: squizlabs/php_codesniffer

4. PHP Mess Detector aka phpmd

phpmd

πŸ™‹ Purpose: Static analysis tool to detect code smells, bad design, bugs, unused parameters, etc.
🌠 GitHub stars: 1,315
πŸ”— URL: phpmd/phpmd

5. PHP Coding Standard Fixer aka php-cs-fixer

php-cs-fixer

πŸ™‹ Purpose: Automatically fixes coding standard violations
🌠 GitHub stars: 7,036
πŸ”— URL: friendsofphp/php-cs-fixer

6. SensioLabs Security Checker

security-checker

πŸ™‹ Purpose: The SensioLabs Security Checker is a command line tool that checks if your application uses dependencies with known security vulnerabilities
🌠 GitHub stars: 1,397
πŸ”— URL: sensiolabs/security-checker

7. XML Linter

πŸ™‹ Purpose: A PHP tool to lint and validate XML files from the command line
🌠 GitHub stars: 6
πŸ”— URL: sclable/xml-lint

8. YAML Linter

πŸ™‹ Purpose: Compact command line utility for checking YAML file syntax
🌠 GitHub stars: 3
πŸ”— URL: j13k/yaml-lint

9. Dockerfile Linter

πŸ™‹ Purpose: Rule based Dockerfile linter
🌠 GitHub stars: 259
πŸ”— URL: projectatomic/dockerfile_lint

10. Shellcheck

πŸ™‹ Purpose: A static analysis tool for shell scripts
🌠 GitHub stars: 13,440
πŸ”— URL: koalaman/shellcheck

11. Swagger CLI

swagger-cli

πŸ™‹ Purpose: Validate Swagger/OpenAPI files in JSON or YAML format
🌠 GitHub stars: 125
πŸ”— URL: APIDevTools/swagger-cli


All these tools can be run automatically:

  • in your IDE
  • in a git hook
  • in your CI/CD pipeline

If you want to go further, please have a look at one of my former articles.

Thanks for reading.

See ya!