algoritma / phpinfo
A lightweight CLI tool to fetch and inspect PHP settings by running `phpinfo()` via HTTP in your web application's environment. This tool is particularly useful for verifying the actual configuration of a running FPM instance when CLI settings might differ.
Requires
- php: >=8.4
- symfony/console: ^6.4|^7.4|^8.0
- symfony/dotenv: ^6.4|^7.4|^8.0
Requires (Dev)
- algoritma/php-coding-standards: ^3.0
- phpunit/phpunit: ^12.5
This package is auto-updated.
Last update: 2026-03-06 11:40:43 UTC
README
A lightweight CLI tool to fetch and inspect PHP settings by running phpinfo() via HTTP in your web application's environment. This tool is particularly useful for verifying the actual configuration of a running FPM instance when CLI settings might differ.
Features
- Accurate Info: Fetches settings from the perspective of the web server, not the CLI.
- Secure: Uses a randomly named temporary file that is automatically deleted after each request.
- Filtering: View only important settings, search for specific keys, or filter by extension/section.
- Colorized Output: Easy-to-read terminal output with a legend for local vs. default values.
Requirements
- PHP 8.4 or higher.
- PHP cURL extension.
- Write access to the public directory of your web application.
Installation
Via Composer
You can install this tool as a dependency in your project:
composer require algoritma/phpinfo
Or install it globally:
composer global require algoritma/phpinfo
Utilization
The tool provides a single command: php:info.
Basic Usage
You must provide the base URL of your application. The tool will automatically attempt to guess your project's public directory.
bin/phpinfo https://myapp.local
Configuration via Environment Variables
You can set default values in a .env file in your current directory:
APP_URL=https://myapp.local APP_PUBLIC_DIR=/var/www/html/public
Advanced Options
-
Specific Public Directory: If the tool cannot guess it correctly.
bin/phpinfo https://myapp.local /var/www/html/my-public-dir
-
Filter by Section: Show only specific extensions or sections.
bin/phpinfo https://myapp.local --section=core --section=opcache
-
Search for a Key: Find a specific configuration directive.
bin/phpinfo https://myapp.local --search=memory
-
Show Important Settings: Display a curated list of the most relevant production settings.
bin/phpinfo https://myapp.local --important
-
Skip SSL Verification: Useful for local development with self-signed certificates.
bin/phpinfo https://myapp.local --no-verify
Contributing
Contributions are welcome! To contribute, follow these steps:
-
Fork the repository.
-
Install dependencies:
composer install
-
Run Quality Assurance: Before submitting a PR, ensure all tests and quality checks pass:
make qa
This command runs:
- PHPUnit: Unit and integration tests.
- PHPStan: Static analysis.
- Rector: Code upgrades and refactoring checks.
- PHP-CS-Fixer: Coding style checks.
-
Fix Coding Style / Rector: If there are issues, you can run:
make qa-fix
Project Structure
bin/: The CLI entry point.src/Command/: Symfony Console command implementation.src/Service/: Logic for fetching, parsing, filtering, and rendering PHP info.tests/: PHPUnit tests.
License
This project is licensed under the MIT License. See the LICENSE file (if present) or composer.json for details.