Requirements 1.0.0
2024-06-15
431次浏览
First release of yiisoft/requirements package was done. It allows to check if a certain set of defined requirements is met.
<?php
require_once('/path/to/requirements/RequirementsChecker.php');
$config = [
[
'name' => 'PHP version',
'mandatory' => true,
'condition' => version_compare(PHP_VERSION, '7.4.0', '>='),
'by' => '<a href="https://www.yiiframework.com">Yii Framework</a>',
'memo' => 'PHP 7.4.0 or higher is required.',
],
[
'name' => 'PDO MySQL extension',
'mandatory' => false,
'condition' => extension_loaded('pdo_mysql'),
'by' => 'All DB-related classes',
'memo' => 'Required for MySQL database.',
],
[
'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
->check($config)
->getResult();
$requirementsChecker->render();
exit($result['summary']['errors'] === 0 ? 0 : 1);
新闻归档
热门标签
- yii3
- 扩展
- 发布
- yii2
- debug
- auth client
- view
- bootstrap
- release
- html
- redis
- apidoc
- Yii 2.0
- Yii 1.1
- mongodb
- mailer
- extensions
- twig
- gii
- queue
- runner
- http 客户端
- console
- validation
- cache
- sphinx
- widget
- hydrator
- translator
- symfonymailer
- db
- http
- log
- error handler
- config
- swiftmailer
- 图书
- imagine
- assets
- i18n
- IDE
- swagger
- elasticsearch
- router
- csrf
- smarty
- definitions
- logging
- fastroute
- user