yousha / php-ini-scanner
A lightweight CLI tool to audit php.ini configurations against development and production standards.
Requires
- php: 7.4.* || 8.*
- symfony/console: ^5.4
Requires (Dev)
- ergebnis/composer-normalize: 2.*
- friendsofphp/php-cs-fixer: 3.*
- overtrue/phplint: 3.*
- phpunit/phpunit: ^9.6 || ^10.5 || ^11.5 || ^12.0
- rector/rector: 2.*
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A lightweight CLI tool to audit php.ini configurations against development and production standards.
It compares configured settings against recommended values for either Development or Production environments.
Built using SOLID principles, strict_types=1, and PSR-compliant code.
Requirements
- Windows or GNU/Linux OS
- PHP 7.4 or later (PHP 8.x supported).
- Composer 2 or later.
Screenshots
Installation
Install it in a project:
composer require yousha/php-ini-scanner
Or install it globally:
composer global require yousha/php-ini-scanner
For a global installation, make sure Composer's global vendor bin directory is included in your system PATH.
Usage
Scan for Production
To scan the automatically loaded configuration for the current PHP runtime:
php ./vendor/bin/php-ini-scanner scan -p
Or scan a specific configuration file:
php ./vendor/bin/php-ini-scanner scan -p -i /path/to/php.ini
Scan for Development
To scan the automatically loaded configuration for the current PHP runtime:
php ./vendor/bin/php-ini-scanner scan -d
Scan a specific configuration file:
php ./vendor/bin/php-ini-scanner scan -d -i /path/to/php.ini
For a global Composer installation, run php-ini-scanner instead of php ./vendor/bin/php-ini-scanner.
Commands and options
| Option | Shortcut | Description |
|---|---|---|
--production |
-p |
Use the production rule set. Exactly one of -p or -d is required. |
--development |
-d |
Use the development rule set. Exactly one of -d or -p is required. |
--ini-path |
-i |
Path to the php.ini file. If omitted, the scanner uses the configuration loaded by the current PHP runtime. |
--php-version |
Target PHP version used to select version-specific rules. Accepts MAJOR.MINOR or MAJOR.MINOR.PATCH; |
Exit codes
0: The scan completed and all checked rules passed.1: The scan encountered a failure or error.
Testing
Run the test suite:
composer test
Run the test suite with code coverage:
composer test-coverage
Coverage reporting requires a supported PHP coverage driver, such as Xdebug or PCOV.
License
This open-source software is distributed under the GPL-3.0-only license. See the LICENSE file.
