├── LICENSE.md ├── README.md ├── composer.json ├── index.php └── protected ├── .htaccess ├── controllers └── SiteController.php └── vendor └── .gitignore /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Yii 2 Benchmark Application 2 | =========================== 3 | 4 | Yii 2 Benchmark Application is an application built to demonstrate the minimal overhead 5 | introduced by the Yii framework. The application contains a single page which only renders 6 | the "hello world" string. 7 | 8 | The application attempts to simulate the scenario in which you can achieve the best performance 9 | when using Yii. It does so by assuming that both of the main application configuration and the page 10 | content are cached in memory, and the application enables pretty URLs. 11 | 12 | 13 | DIRECTORY STRUCTURE 14 | ------------------- 15 | 16 | protected/ contains application source code 17 | controllers/ contains Web controller classes 18 | index.php the entry script 19 | 20 | 21 | REQUIREMENTS 22 | ------------ 23 | 24 | The minimum requirement by Yii is that your Web server supports PHP 5.4.0. 25 | 26 | 27 | INSTALLATION 28 | ------------ 29 | 30 | If you do not have [Composer](https://getcomposer.org/), you may download it from 31 | [https://getcomposer.org/](https://getcomposer.org/) or run the following command on Linux/Unix/MacOS: 32 | 33 | ``` 34 | curl -s https://getcomposer.org/installer | php 35 | mv composer.phar /usr/local/bin/composer 36 | ``` 37 | 38 | You can then install the Bootstrap Application using the following command: 39 | 40 | ``` 41 | composer global require "fxp/composer-asset-plugin:~1.1.0" 42 | composer create-project --prefer-dist yiisoft/yii2-app-benchmark yii-benchmark 43 | ``` 44 | 45 | Now you should be able to access the benchmark page using the URL 46 | 47 | ``` 48 | http://localhost/yii-benchmark/index.php/site/hello 49 | ``` 50 | 51 | In the above, we assume `yii-benchmark` is directly under the document root of your Web server. 52 | 53 | Note that in order to install some dependencies you must have PHP with OpenSSL support. 54 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yiisoft/yii2-app-benchmark", 3 | "description": "Yii 2 Benchmark Application", 4 | "keywords": ["yii2", "framework", "benchmark", "application"], 5 | "homepage": "https://www.yiiframework.com/", 6 | "type": "project", 7 | "license": "BSD-3-Clause", 8 | "support": { 9 | "issues": "https://github.com/yiisoft/yii2/issues?state=open", 10 | "forum": "https://www.yiiframework.com/forum/", 11 | "wiki": "https://www.yiiframework.com/wiki/", 12 | "irc": "ircs://irc.libera.chat:6697/yii", 13 | "source": "https://github.com/yiisoft/yii2" 14 | }, 15 | "config": { 16 | "vendor-dir": "protected/vendor" 17 | }, 18 | "minimum-stability": "dev", 19 | "require": { 20 | "php": ">=5.4.0", 21 | "yiisoft/yii2": ">=2.0.4" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 'benchmark', 9 | 'basePath' => __DIR__ . '/protected', 10 | 'components' => [ 11 | 'urlManager' => [ 12 | 'enablePrettyUrl' => true, 13 | ], 14 | ], 15 | ]; 16 | 17 | $application = new yii\web\Application($config); 18 | $application->run(); 19 | -------------------------------------------------------------------------------- /protected/.htaccess: -------------------------------------------------------------------------------- 1 | deny from all 2 | -------------------------------------------------------------------------------- /protected/controllers/SiteController.php: -------------------------------------------------------------------------------- 1 |