yiisoft / requirements
Requirements checker
Fund package maintenance!
Open Collective
yiisoft
Installs: 718
Dependents: 0
Suggesters: 0
Security: 0
Stars: 19
Watchers: 16
Forks: 5
Open Issues: 5
Requires
- php: ^7.4|^8.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- roave/infection-static-analysis-plugin: ^1.16
- spatie/phpunit-watcher: ^1.23
- vimeo/psalm: ^4.19
This package is auto-updated.
Last update: 2023-08-31 00:31:51 UTC
README
Yii Requirements Checker
The package allows to check if a certain set of defined requirements is met.
General usage
Requirements checker could be used either from web or from command line. Create requirements.php
:
<?php require_once('/path/to/requirements/RequirementsChecker.php'); $config = array( array( 'name' => 'PHP version', 'mandatory' => true, 'condition' => version_compare(PHP_VERSION, '7.2.0', '>='), 'by' => '<a href="http://www.yiiframework.com">Yii Framework</a>', 'memo' => 'PHP 7.2.0 or higher is required.', ), array( 'name' => 'PDO MySQL extension', 'mandatory' => false, 'condition' => extension_loaded('pdo_mysql'), 'by' => 'All DB-related classes', 'memo' => 'Required for MySQL database.', ), array( 'name' => 'Intl extension', 'mandatory' => false, 'condition' => $this->checkPhpExtensionVersion('intl', '1.0.2', '>='), 'by' => '<a href="https://secure.php.net/manual/en/book.intl.php">Internationalization</a> support', 'memo' => 'PHP Intl extension 1.0.2 or higher is required.' ), ); $requirementsChecker = new RequirementsChecker(); $result = $requirementsChecker ->checkYii() ->check($config) ->getResult(); $requirementsChecker->render(); exit($result['summary']['errors'] === 0 ? 0 : 1);
Now it could be either put to webroot or executed as php requirements.php
.
Note that the code above uses PHP 4. That is done on purpose so the checker could be executed in a very old setups and tell that upgrade should be done.
Unit testing
The package is tested with PHPUnit. To run tests:
./vendor/bin/phpunit
Mutation testing
The package tests are checked with Infection mutation framework. To run it:
./vendor/bin/infection
Static analysis
The code is statically analyzed with Psalm. To run static analysis:
./vendor/bin/psalm
Support the project
Follow updates
License
The Yii Requirements Checker is free software. It is released under the terms of the BSD License.
Please see LICENSE
for more information.
Maintained by Yii Software.