lukaszzychal / php-compatibility-tester
Universal, reusable Composer package for testing PHP library compatibility with various frameworks and PHP versions
Installs: 136
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/lukaszzychal/php-compatibility-tester
Requires
- php: ^8.1
- symfony/console: ^6.0|^7.0
- symfony/process: ^6.0|^7.0
- symfony/yaml: ^6.0|^7.0
Requires (Dev)
- lukaszzychal/phpstan-fixer: ^1.0
- phpstan/phpstan: ^1.10 || ^2.0
- phpunit/phpunit: ^10.0
- vimeo/psalm: ^6.0
- dev-main
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- dev-docs/add-author-information
- dev-fix/symfony-console-7-compatibility
- dev-refactor/replace-phpstan-with-phpstan-fixer
- dev-fix/trufflehog-initial-push
- dev-fix/workflow-artifacts
- dev-docs/add-branch-protection-guide
- dev-feature/github-mcp-server-integration
- dev-fix/rename-github-readme
- dev-docs/add-readme-badges
- dev-fix/dockerfile-mbstring-dependency
- dev-dependabot/composer/phpstan/phpstan-tw-1.10or-tw-2.0
This package is auto-updated.
Last update: 2025-12-08 01:59:26 UTC
README
A universal, reusable Composer package for testing PHP library compatibility with various frameworks (Laravel, Symfony, CodeIgniter, etc.) and PHP versions.
What does this package do?
In short: This package automatically tests whether your PHP library works with different frameworks and PHP versions.
The Problem It Solves
When you create a PHP library (e.g., vendor/my-package), you need to know:
- ✅ Does it work with Laravel 11 and 12?
- ✅ Does it work with Symfony 7 and 8?
- ✅ Does it work on PHP 8.1, 8.2, 8.3, 8.4?
- ✅ Are there any dependency conflicts?
Manually checking all these combinations is time-consuming and error-prone.
How It Works (Step by Step)
-
Creates temporary framework projects
- For each framework/version, it creates a fresh project (e.g.,
composer create-project laravel/laravel)
- For each framework/version, it creates a fresh project (e.g.,
-
Installs your library
- In each project, it installs your library via Composer
-
Runs your tests
- Executes your custom test scripts (e.g., checks if classes can be autoloaded)
-
Generates a report
- Creates a detailed report (Markdown/JSON/HTML) with all results
Example Output
The report shows you:
- ✅ Laravel 11.* + PHP 8.2 - WORKS
- ❌ Laravel 12.* + PHP 8.1 - FAILS (requires PHP 8.2+)
- ✅ Symfony 7.4.* + PHP 8.3 - WORKS
- And so on...
Real-World Analogy
Think of it like unit tests, but for compatibility:
- Unit tests = Does my code work correctly?
- Compatibility Tester = Does my code work in different environments?
Who Is This For?
- Library creators - Want to know what your library works with
- Package maintainers - Need to support multiple frameworks
- Teams - Want to automatically check compatibility in CI/CD
In One Sentence
Automatically tests if your PHP library works with different frameworks and PHP versions, without manually checking every combination.
Features
- Test compatibility across multiple PHP versions (8.1+)
- Support for major PHP frameworks (Laravel, Symfony, CodeIgniter, Laminas, Yii, CakePHP, Slim, Lumen, Phalcon)
- YAML-based configuration
- CLI commands for easy testing
- Multiple report formats (Markdown, JSON, HTML)
- GitHub Actions integration
- Custom test scripts support
Installation
Install via Composer:
composer require --dev lukaszzychal/php-compatibility-tester
Quick Start
- Initialize the configuration in your project:
vendor/bin/compatibility-tester init
This will create a .compatibility.yml configuration file and copy necessary templates.
- Edit
.compatibility.ymlto configure your tests:
package_name: "your-vendor/your-package" php_versions: ['8.1', '8.2', '8.3', '8.4'] frameworks: laravel: versions: ['11.*', '12.*'] install_command: 'composer create-project laravel/laravel' php_min_version: '8.1'
- Run compatibility tests:
vendor/bin/compatibility-tester test
- Generate a report:
vendor/bin/compatibility-tester report --format=markdown --output=report.md
Usage
Initialize Configuration
vendor/bin/compatibility-tester init
Creates .compatibility.yml and copies template files to your project.
Run Tests
# Run all tests vendor/bin/compatibility-tester test # Filter by framework vendor/bin/compatibility-tester test --framework=laravel # Filter by framework version vendor/bin/compatibility-tester test --framework=laravel --version=11.* # Filter by PHP version vendor/bin/compatibility-tester test --php=8.3
Generate Reports
# Generate Markdown report (default) vendor/bin/compatibility-tester report # Generate JSON report vendor/bin/compatibility-tester report --format=json --output=report.json # Generate HTML report vendor/bin/compatibility-tester report --format=html --output=report.html
Configuration
The .compatibility.yml file supports the following options:
package_name: Your package name (e.g., "vendor/package")php_versions: Array of PHP versions to testframeworks: Framework configurationsversions: Framework versions to testinstall_command: Command to create framework projectphp_min_version: Minimum PHP version requiredphp_min_version_X: Version-specific PHP requirements
test_scripts: Custom test scripts to rungithub_actions: GitHub Actions workflow settings
See Configuration Documentation for detailed information.
Supported Frameworks
- Laravel (11.x, 12.x)
- Symfony (7.4.x, 8.0.x)
- CodeIgniter (4.x, 5.x)
- Laminas (3.x)
- Yii (2.0.x)
- CakePHP (5.x)
- Slim (4.x, 5.x)
- Lumen (11.x)
- Phalcon (5.x)
Requirements
- PHP 8.1 or higher
- Composer
- Symfony Console, Process, and YAML components (installed automatically)
Documentation
- Installation Guide
- Configuration Reference
- Usage Guide
- GitHub MCP Server Integration - Automatyczne raportowanie i integracja z GitHub
- CI/CD Documentation
- Examples
Links
- Packagist: lukaszzychal/php-compatibility-tester
- GitHub: lukaszzychal/php-compatibility-tester
- Issues: Report a bug or request a feature
- Discussions: Ask questions and share ideas
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Open an Issue to report bugs or suggest features
- Start a Discussion to ask questions or share ideas
- Submit a Pull Request to contribute code
License
This package is open-sourced software licensed under the MIT license.
Author
Lukasz Zychal