├── runtime └── .gitignore ├── .styleci.yml ├── .github ├── FUNDING.yml ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE.md ├── SECURITY.md ├── CONTRIBUTING.md └── CODE_OF_CONDUCT.md ├── config ├── env.php ├── params.php ├── web.php └── common.php ├── .editorconfig ├── .scrutinizer.yml ├── src ├── Controllers │ └── SiteController.php └── Models │ └── User.php ├── phpunit.xml.dist ├── README.md ├── .gitignore ├── tests └── bootstrap.php ├── LICENSE.md ├── composer.json ├── .travis.yml └── requirements.php /runtime/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | preset: psr12 2 | 3 | finder: 4 | exclude: 5 | - docs 6 | - vendor 7 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | open_collective: yiisoft 4 | github: [yiisoft] 5 | -------------------------------------------------------------------------------- /config/env.php: -------------------------------------------------------------------------------- 1 | 'my-project', 5 | 'app.name' => 'MyProject', 6 | 7 | 'adminEmail' => 'admin@example.com', 8 | 9 | 'db.dsn' => 'mysql:host=localhost;dbname=myproject;charset=utf8', 10 | 'db.username' => 'root', 11 | 'db.password' => '', 12 | 13 | 'favicon.ico' => '@yii/app/../public/favicon.ico', 14 | ]; 15 | -------------------------------------------------------------------------------- /src/Controllers/SiteController.php: -------------------------------------------------------------------------------- 1 | 'hello world!']; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | ./tests 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | Yii Framework 4 | 5 |

Yii Framework REST API Application

6 |
7 |

8 | 9 | 10 | This package is deprecated. Please use [yiisoft/app](https://github.com/yiisoft/app) or [yiisoft/yii-demo](https://github.com/yiisoft/yii-demo) instead. 11 | 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # phpstorm project files 2 | .idea 3 | 4 | # netbeans project files 5 | nbproject 6 | 7 | # zend studio for eclipse project files 8 | .buildpath 9 | .project 10 | .settings 11 | 12 | # windows thumbnail cache 13 | Thumbs.db 14 | 15 | # composer vendor dir 16 | /vendor 17 | /composer.lock 18 | 19 | # composer itself is not needed 20 | composer.phar 21 | 22 | # Mac DS_Store Files 23 | .DS_Store 24 | 25 | # phpunit itself is not needed 26 | phpunit.phar 27 | # local phpunit config 28 | /phpunit.xml 29 | 30 | tests/_output/* 31 | tests/_support/_generated 32 | 33 | #vagrant folder 34 | /.vagrant 35 | 36 | .env 37 | -------------------------------------------------------------------------------- /config/web.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'controllerNamespace' => Yiisoft\Yii\Base\Api\Controllers::class, 6 | ], 7 | 'user' => [ 8 | 'identityClass' => Yiisoft\Yii\Base\Api\Models\User::class, // User must implement the IdentityInterface 9 | 'enableAutoLogin' => false, 10 | 'enableSession' => false, 11 | 'loginUrl' => null, 12 | ], 13 | 'request' => [ 14 | 'enableCookieValidation' => false, 15 | ], 16 | 'urlManager' => [ 17 | 'enablePrettyUrl' => true, 18 | 'showScriptName' => false, 19 | ], 20 | ]; 21 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'basePath' => dirname(__DIR__) . '/src', 6 | /* 7 | 'controllerMap' => [ 8 | 'fixture' => [ // Fixture generation command line. 9 | '__class' => 'yii\faker\FixtureController', 10 | ], 11 | ], 12 | */ 13 | ], 14 | 'logger' => [ 15 | '__construct()' => [ 16 | 'targets' => [ 17 | [ 18 | '__class' => Yiisoft\Log\FileTarget::class, 19 | 'levels' => ['error', 'warning'], 20 | ], 21 | ], 22 | ], 23 | ], 24 | 'cache' => [ 25 | '__class' => Yiisoft\Cache\Cache::class, 26 | 'handler' => [ 27 | '__class' => Yiisoft\Cache\FileCache::class, 28 | 'keyPrefix' => 'my-project', 29 | ], 30 | ], 31 | 'db' => array_filter([ 32 | '__class' => Yiisoft\Db\Connection::class, 33 | 'dsn' => $params['db.dsn'], 34 | 'username' => $params['db.username'], 35 | 'password' => $params['db.password'], 36 | 'enableSchemaCache' => defined('YII_ENV') && YII_ENV !== 'dev', 37 | ]), 38 | 39 | // 'translator' => [ 40 | // 'translations' => [ 41 | // 'yii-base-api' => [ 42 | // '__class' => yii\i18n\PhpMessageSource::class, 43 | // 'sourceLanguage' => 'en-US', 44 | // 'basePath' => '@yii/app/messages', 45 | // ], 46 | // ], 47 | // ], 48 | ]; 49 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Yii Software LLC nor the names of its 15 | contributors may be used to endorse or promote products derived 16 | from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yiisoft/yii-base-api", 3 | "type": "library", 4 | "description": "Yii Framework REST API Application Base", 5 | "keywords": [ 6 | "yii", 7 | "framework", 8 | "application", 9 | "rest", 10 | "api" 11 | ], 12 | "homepage": "https://github.com/yiisoft/yii-base-api", 13 | "license": "BSD-3-Clause", 14 | "support": { 15 | "source": "https://github.com/yiisoft/yii-base-api", 16 | "issues": "https://github.com/yiisoft/yii-base-api/issues", 17 | "forum": "http://www.yiiframework.com/forum/", 18 | "wiki": "http://www.yiiframework.com/wiki/", 19 | "irc": "irc://irc.freenode.net/yii" 20 | }, 21 | "minimum-stability": "dev", 22 | "prefer-stable": true, 23 | "require": { 24 | "php": "^7.4", 25 | "yiisoft/yii-rest": "^3.0@dev", 26 | "yiisoft/di": "^3.0@dev", 27 | "yiisoft/log": "^3.0@dev", 28 | "yiisoft/cache": "^3.0@dev", 29 | "yiisoft/active-record": "^3.0@dev", 30 | "vlucas/phpdotenv": "^4.0", 31 | "yiisoft/composer-config-plugin": "^1.0@dev" 32 | }, 33 | "require-dev": { 34 | "phpunit/phpunit": "^9.0" 35 | }, 36 | "extra": { 37 | "branch-alias": { 38 | "dev-master": "3.0.x-dev" 39 | }, 40 | "config-plugin": { 41 | "params": "config/params.php", 42 | "common": "config/common.php", 43 | "web": "config/web.php" 44 | } 45 | }, 46 | "autoload": { 47 | "psr-4": { 48 | "Yiisoft\\Yii\\Base\\Api\\": "src" 49 | } 50 | }, 51 | "autoload-dev": { 52 | "psr-4": { 53 | "Yiisoft\\Yii\\Base\\Api\\Tests\\": "tests" 54 | } 55 | }, 56 | "config": { 57 | "process-timeout": 1800, 58 | "sort-packages": true 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Yii Contributor Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | As contributors and maintainers of this project, and in order to keep Yii community open and welcoming, we ask to respect all community members. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or 20 | advances 21 | * Personal attacks 22 | * Trolling or insulting/derogatory comments, and personal or political attacks 23 | * Public or private harassment 24 | * Publishing other's private information, such as physical or electronic 25 | addresses, without explicit permission 26 | * Other conduct which could reasonably be considered inappropriate in 27 | a professional setting 28 | 29 | ## Our Responsibilities 30 | 31 | Project maintainers are responsible for clarifying the standards of acceptable 32 | behavior and are expected to take appropriate and fair corrective action in response 33 | to any instances of unacceptable behavior. 34 | 35 | Project maintainers have the right and responsibility to remove, edit, or reject comments, 36 | commits, code, wiki edits, issues, and other contributions that are not aligned to this 37 | Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors 38 | that they deem inappropriate, threatening, offensive, or harmful. 39 | 40 | ## Scope 41 | 42 | This Code of Conduct applies both within project spaces and in public spaces when 43 | an individual is representing the project or its community. Examples of representing 44 | a project or community include posting via an official social media account, 45 | within project GitHub, official forum or acting as an appointed representative at 46 | an online or offline event. 47 | 48 | ## Enforcement 49 | 50 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported 51 | by contacting core team members. All complaints will be reviewed and investigated 52 | and will result in a response that is deemed necessary and appropriate to the circumstances. 53 | The project team is obligated to maintain confidentiality with regard to the reporter of 54 | an incident. Further details of specific enforcement policies may be posted separately. 55 | 56 | Project maintainers who do not follow or enforce the Code of Conduct in good faith 57 | may face temporary or permanent repercussions as determined by other members of 58 | the project's leadership. 59 | 60 | ## Attribution 61 | 62 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 63 | version 1.4.0, available at 64 | [http://contributor-covenant.org/version/1/4/][version] 65 | 66 | [homepage]: http://contributor-covenant.org 67 | [version]: http://contributor-covenant.org/version/1/4/ 68 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | env: 4 | global: 5 | - DEFAULT_COMPOSER_FLAGS="--prefer-dist --no-interaction --no-progress --optimize-autoloader" 6 | - TASK_STATIC_ANALYSIS=0 7 | - TASK_TESTS_COVERAGE=0 8 | 9 | matrix: 10 | include: 11 | - php: "7.4" 12 | env: 13 | - TASK_STATIC_ANALYSIS=0 # set to 1 to enable static analysis 14 | - TASK_TESTS_COVERAGE=1 15 | 16 | # faster builds on new travis setup not using sudo 17 | sudo: false 18 | 19 | # cache vendor dirs 20 | cache: 21 | directories: 22 | - $HOME/.composer/cache 23 | 24 | before_install: 25 | - phpenv config-rm xdebug.ini || echo "xdebug is not installed" 26 | 27 | install: 28 | - travis_retry composer self-update && composer --version 29 | - export PATH="$HOME/.composer/vendor/bin:$PATH" 30 | - travis_retry composer install $DEFAULT_COMPOSER_FLAGS 31 | - | 32 | if [ $TASK_STATIC_ANALYSIS == 1 ]; then 33 | pecl install ast 34 | fi 35 | 36 | before_script: 37 | - php --version 38 | - composer --version 39 | # enable code coverage 40 | - | 41 | if [ $TASK_TESTS_COVERAGE == 1 ]; then 42 | PHPUNIT_COVERAGE_FLAG="--coverage-clover=coverage.clover" 43 | fi 44 | 45 | script: 46 | - phpdbg -qrr vendor/bin/phpunit --verbose $PHPUNIT_COVERAGE_FLAG 47 | - | 48 | if [ $TASK_STATIC_ANALYSIS == 1 ]; then 49 | composer phan 50 | fi 51 | - | 52 | if [ $TASK_STATIC_ANALYSIS == 1 ]; then 53 | cat analysis.txt 54 | fi 55 | 56 | after_script: 57 | - | 58 | if [ $TASK_TESTS_COVERAGE == 1 ]; then 59 | travis_retry wget https://scrutinizer-ci.com/ocular.phar 60 | php ocular.phar code-coverage:upload --format=php-clover coverage.clover 61 | fi 62 | 63 | notifications: 64 | slack: 65 | - 66 | rooms: 67 | - 68 | secure: l6qbR7OfWsCwKfur6SnXC6tDtD8yrEcDp0WTbahLm/9mJw5h/m1rLhFQmq3OmK7XUsM/dF3+3fqN5EeWHuQtTN62Irjq/lBN4vSZYd9+YWKzMCLBoJVjbUwt+eTE8L2PDADNMvPfql4sfzSSjGHyn4h8IalPAkkqwDK+S7jGJxUMsF/VOr7vQE/wqIZamMvt60PWE7eQv3OagBsqdspt/XkhSb2F88/dBXId7+7Aw76oQk152kKWA1lQhnYrcbU63en7Qe/jbACpom6keHReJcObv0ZSC8lC2bwfR5RCD9eckPZ8Pw+kRjc92IWJqi0d4H2FAVZxtTfkT9PVbm2PPe37wDNGCs1QzQlPxHebhL5GM64Uhl+rj5vThjcqOFEYFjyxwISHLJOby60A2GswzhOT9143fbM+j2+/x98sPrv6e3HIzSuFsOggZPfXcbc42RVduydTTNJEe70CxY2QRghuLszD2yS8KpOQN8FAjPmhx/sqb7i8F7/sbzYlAy52kmxaV33OKfx+xza9Zsp91yhx0kmzWSoJYWYcFKJp3p1m82qVz0Yg1n3qjW7LiOCSg4HA6lAtbqfyTtotaa37PgSFSo6mJztpQdrVqYyFTXZ63abWBIckEncnORVwFzJxrb2rltC8Y60tDEI8vqZLrDENQaspVS2zyEiL0gjpI18= 69 | on_success: always 70 | on_failure: never 71 | on_pull_requests: false 72 | - 73 | rooms: 74 | - 75 | secure: p/u++s2nmdozIwP4k6jUKoaq0jKY/2zkfWm0HaCFCew48El9Wc2Y40DveZrI4N5eoMf8BG8mpnu2JIjjY+8EkqZjYguF9/5ru7DUAeM/3RivySp+HhWA+vNxs7/VC4DWZyM6uzVGq4CTkWwdxO8yZ+mrUFKwtRTCUEosqaHEKrToOw2SYwoNpD3UAQPJJA/6pEdAX3ly0LgSYHHD8smjFu5PHoEYsgqJf54cVZnVNqIP5SvxRSQOD4LG0uBaXEj5XYpL0sB5ke6FzqLgc0r2Anaydlo0rRI3IL3HyPPy2nZ/3/JSXVrrjYPYm+/JHar8le1cn5QJDulEd/cKWZiC6MKRN2ADJJNSy244Hb+yti9yYaMivXv20wizgsZyI6tyyySruDtMOQyVY/1E/QhIhN7z0nCj0evBG/X9WLvT4kdHj12SVNwYI1OzNYcbHQXwjen7h10z4Prtn6qLh37Vwukff5+C6HLOxx2n2xn/6k6/Jnz4N8Df3Hh2XVvdvUbjmDBWqC/M06QEzdfKWLpY2yLGeSvT3qrBSNwy6UMOop1yfQH7EHoLGyFtYxn5mv0UhNDq+5o0BT9x0slkXsfcAQ/IJTSNQ2+HAeDwJGxRz/NeyHxcReQZKaBFfVxqqVPaxamwhA8EvdeAWtZFrIPYiLeaR6Ai0S9+UPhNLxhYbLo= 76 | on_success: never 77 | on_failure: always 78 | on_pull_requests: false 79 | -------------------------------------------------------------------------------- /src/Models/User.php: -------------------------------------------------------------------------------- 1 | self::STATUS_ACTIVE], 46 | ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]], 47 | ]; 48 | } 49 | 50 | public static function findIdentity($id) 51 | { 52 | return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); 53 | } 54 | 55 | public static function findIdentityByAccessToken($token, $type = null) 56 | { 57 | throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); 58 | } 59 | 60 | /** 61 | * Finds user by username. 62 | * 63 | * @param string $username 64 | * 65 | * @return static|null 66 | */ 67 | public static function findByUsername($username) 68 | { 69 | return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]); 70 | } 71 | 72 | /** 73 | * Finds user by password reset token. 74 | * 75 | * @param string $token password reset token 76 | * 77 | * @return static|null 78 | */ 79 | public static function findByPasswordResetToken($token) 80 | { 81 | if (!static::isPasswordResetTokenValid($token)) { 82 | return; 83 | } 84 | 85 | return static::findOne([ 86 | 'password_reset_token' => $token, 87 | 'status' => self::STATUS_ACTIVE, 88 | ]); 89 | } 90 | 91 | /** 92 | * Finds out if password reset token is valid. 93 | * 94 | * @param string $token password reset token 95 | * 96 | * @return bool 97 | */ 98 | public static function isPasswordResetTokenValid($token) 99 | { 100 | if (empty($token)) { 101 | return false; 102 | } 103 | 104 | $timestamp = (int) substr($token, strrpos($token, '_') + 1); 105 | $expire = Yii::getApp()->params['user.passwordResetTokenExpire']; 106 | 107 | return $timestamp + $expire >= time(); 108 | } 109 | 110 | public function getId() 111 | { 112 | return $this->getPrimaryKey(); 113 | } 114 | 115 | public function getAuthKey() 116 | { 117 | return $this->auth_key; 118 | } 119 | 120 | public function validateAuthKey($authKey) 121 | { 122 | return $this->getAuthKey() === $authKey; 123 | } 124 | 125 | /** 126 | * Validates password. 127 | * 128 | * @param string $password password to validate 129 | * 130 | * @return bool if password provided is valid for current user 131 | */ 132 | public function validatePassword($password) 133 | { 134 | return Yii::getApp()->security->validatePassword($password, $this->password_hash); 135 | } 136 | 137 | /** 138 | * Generates password hash from password and sets it to the model. 139 | * 140 | * @param string $password 141 | */ 142 | public function setPassword($password) 143 | { 144 | $this->password_hash = Yii::getApp()->security->generatePasswordHash($password); 145 | } 146 | 147 | /** 148 | * Generates "remember me" authentication key. 149 | */ 150 | public function generateAuthKey() 151 | { 152 | $this->auth_key = Yii::getApp()->security->generateRandomString(); 153 | } 154 | 155 | /** 156 | * Generates new password reset token. 157 | */ 158 | public function generatePasswordResetToken() 159 | { 160 | $this->password_reset_token = Yii::getApp()->security->generateRandomString() . '_' . time(); 161 | } 162 | 163 | /** 164 | * Removes password reset token. 165 | */ 166 | public function removePasswordResetToken() 167 | { 168 | $this->password_reset_token = null; 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /requirements.php: -------------------------------------------------------------------------------- 1 | Error\n\n" 32 | . "

The path to yii framework seems to be incorrect.

\n" 33 | . '

You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . ".

\n" 34 | . '

Please refer to the README on how to install Yii.

\n"; 35 | 36 | if (!empty($_SERVER['argv'])) { 37 | // do not print HTML when used in console mode 38 | echo strip_tags($message); 39 | } else { 40 | echo $message; 41 | } 42 | exit(1); 43 | } 44 | 45 | require_once $frameworkPath . '/requirements/YiiRequirementChecker.php'; 46 | $requirementsChecker = new YiiRequirementChecker(); 47 | 48 | $gdMemo = $imagickMemo = 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.'; 49 | $gdOK = $imagickOK = false; 50 | 51 | if (extension_loaded('imagick')) { 52 | $imagick = new Imagick(); 53 | $imagickFormats = $imagick->queryFormats('PNG'); 54 | if (in_array('PNG', $imagickFormats)) { 55 | $imagickOK = true; 56 | } else { 57 | $imagickMemo = 'Imagick extension should be installed with PNG support in order to be used for image CAPTCHA.'; 58 | } 59 | } 60 | 61 | if (extension_loaded('gd')) { 62 | $gdInfo = gd_info(); 63 | if (!empty($gdInfo['FreeType Support'])) { 64 | $gdOK = true; 65 | } else { 66 | $gdMemo = 'GD extension should be installed with FreeType support in order to be used for image CAPTCHA.'; 67 | } 68 | } 69 | 70 | /** 71 | * Adjust requirements according to your application specifics. 72 | */ 73 | $requirements = [ 74 | // Database : 75 | [ 76 | 'name' => 'PDO extension', 77 | 'mandatory' => true, 78 | 'condition' => extension_loaded('pdo'), 79 | 'by' => 'All DB-related classes', 80 | ], 81 | [ 82 | 'name' => 'PDO SQLite extension', 83 | 'mandatory' => false, 84 | 'condition' => extension_loaded('pdo_sqlite'), 85 | 'by' => 'All DB-related classes', 86 | 'memo' => 'Required for SQLite database.', 87 | ], 88 | [ 89 | 'name' => 'PDO MySQL extension', 90 | 'mandatory' => false, 91 | 'condition' => extension_loaded('pdo_mysql'), 92 | 'by' => 'All DB-related classes', 93 | 'memo' => 'Required for MySQL database.', 94 | ], 95 | [ 96 | 'name' => 'PDO PostgreSQL extension', 97 | 'mandatory' => false, 98 | 'condition' => extension_loaded('pdo_pgsql'), 99 | 'by' => 'All DB-related classes', 100 | 'memo' => 'Required for PostgreSQL database.', 101 | ], 102 | // Cache : 103 | [ 104 | 'name' => 'Memcache extension', 105 | 'mandatory' => false, 106 | 'condition' => extension_loaded('memcache') || extension_loaded('memcached'), 107 | 'by' => 'MemCache', 108 | 'memo' => extension_loaded('memcached') ? 'To use memcached set MemCache::useMemcached to true.' : '', 109 | ], 110 | // CAPTCHA: 111 | [ 112 | 'name' => 'GD PHP extension with FreeType support', 113 | 'mandatory' => false, 114 | 'condition' => $gdOK, 115 | 'by' => 'Captcha', 116 | 'memo' => $gdMemo, 117 | ], 118 | [ 119 | 'name' => 'ImageMagick PHP extension with PNG support', 120 | 'mandatory' => false, 121 | 'condition' => $imagickOK, 122 | 'by' => 'Captcha', 123 | 'memo' => $imagickMemo, 124 | ], 125 | // PHP ini : 126 | 'phpExposePhp' => [ 127 | 'name' => 'Expose PHP', 128 | 'mandatory' => false, 129 | 'condition' => $requirementsChecker->checkPhpIniOff('expose_php'), 130 | 'by' => 'Security reasons', 131 | 'memo' => '"expose_php" should be disabled at php.ini', 132 | ], 133 | 'phpAllowUrlInclude' => [ 134 | 'name' => 'PHP allow url include', 135 | 'mandatory' => false, 136 | 'condition' => $requirementsChecker->checkPhpIniOff('allow_url_include'), 137 | 'by' => 'Security reasons', 138 | 'memo' => '"allow_url_include" should be disabled at php.ini', 139 | ], 140 | 'phpSmtp' => [ 141 | 'name' => 'PHP mail SMTP', 142 | 'mandatory' => false, 143 | 'condition' => strlen(ini_get('SMTP')) > 0, 144 | 'by' => 'Email sending', 145 | 'memo' => 'PHP mail SMTP server required', 146 | ], 147 | ]; 148 | 149 | // OPcache check 150 | if (!version_compare(phpversion(), '5.5', '>=')) { 151 | $requirements[] = [ 152 | 'name' => 'APC extension', 153 | 'mandatory' => false, 154 | 'condition' => extension_loaded('apc'), 155 | 'by' => 'ApcCache', 156 | ]; 157 | } 158 | 159 | $requirementsChecker->checkYii()->check($requirements)->render(); 160 | --------------------------------------------------------------------------------