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
π 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
π 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
π Purpose: Essential PHP dependency manager, and much more
π GitHub stars: 18,049
π URL: Composer
2. 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
π 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
π Purpose: Automatically fixes coding standard violations
π GitHub stars: 7,036
π URL: friendsofphp/php-cs-fixer
6. SensioLabs 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
π 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!