├── .bowerrc ├── .gitignore ├── LICENSE.md ├── README.md ├── Vagrantfile ├── assets └── AppAsset.php ├── codeception.yml ├── commands └── HelloController.php ├── composer.json ├── composer.lock ├── config ├── console.php ├── db.php ├── params.php ├── test.php ├── test_db.php └── web.php ├── controllers └── SiteController.php ├── docker-compose.yml ├── mail └── layouts │ └── html.php ├── models ├── ContactForm.php ├── LoginForm.php └── User.php ├── package.json ├── requirements.php ├── runtime └── .gitignore ├── tests ├── _bootstrap.php ├── _data │ └── .gitkeep ├── _output │ └── .gitignore ├── _support │ ├── AcceptanceTester.php │ ├── FunctionalTester.php │ └── UnitTester.php ├── acceptance.suite.yml.example ├── acceptance │ ├── AboutCest.php │ ├── ContactCest.php │ ├── HomeCest.php │ ├── LoginCest.php │ └── _bootstrap.php ├── bin │ ├── yii │ └── yii.bat ├── functional.suite.yml ├── functional │ ├── ContactFormCest.php │ ├── LoginFormCest.php │ └── _bootstrap.php ├── unit.suite.yml └── unit │ ├── _bootstrap.php │ └── models │ ├── ContactFormTest.php │ ├── LoginFormTest.php │ └── UserTest.php ├── vagrant ├── config │ ├── .gitignore │ └── vagrant-local.example.yml ├── nginx │ ├── app.conf │ └── log │ │ └── .gitignore └── provision │ ├── always-as-root.sh │ ├── once-as-root.sh │ └── once-as-vagrant.sh ├── views ├── assets │ ├── js │ │ ├── app.js │ │ ├── components │ │ │ ├── CardComponent.vue │ │ │ └── JumbotronComponent.vue │ │ └── plugins │ │ │ └── vue-particles.js │ └── sass │ │ └── app.scss ├── layouts │ └── main.php └── site │ ├── about.php │ ├── contact.php │ ├── error.php │ ├── index.php │ └── login.php ├── web ├── .htaccess ├── assets │ └── .gitignore ├── css │ └── site.css ├── favicon.ico ├── img │ ├── vue.png │ └── yii.png ├── index-test.php ├── index.php ├── js │ └── .gitignore └── robots.txt ├── webpack.config.js ├── widgets └── Alert.php ├── yii └── yii.bat /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory" : "vendor/bower-asset" 3 | } 4 | -------------------------------------------------------------------------------- /.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 | 18 | # composer itself is not needed 19 | composer.phar 20 | 21 | # Mac DS_Store Files 22 | .DS_Store 23 | 24 | # phpunit itself is not needed 25 | phpunit.phar 26 | # local phpunit config 27 | /phpunit.xml 28 | 29 | tests/_output/* 30 | tests/_support/_generated 31 | 32 | #vagrant folder 33 | /.vagrant 34 | node_modules 35 | 36 | /node_modules 37 | 38 | /.vscode 39 | 40 | -------------------------------------------------------------------------------- /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 | # yii2-app-vue 2 | 3 | 4 | for yii2 web application width vueJs 5 | ------------ 6 | 7 |  8 | 9 | Installation 10 | ------------ 11 | 12 | The preferred way to install this extension is through [composer](http://getcomposer.org/download/). 13 | 14 | Either run 15 | 16 | - `composer create-project aki/yii2-app-vue basic` 17 | - `php yii migrate` 18 | - `npm install` 19 | 20 | 21 | ## Usage 22 | 23 | ### Development 24 | 25 | ```bash 26 | npm run dev 27 | ``` 28 | or 29 | 30 | ```bash 31 | npm run watch 32 | ``` 33 | 34 | Local Development Server 35 | ----- 36 | If you have PHP installed locally and you would like to use PHP's built-in development server to serve your application, you may use the serve yii command. This command will start a development server at http://localhost:8000: 37 | ``` 38 | php yii serve 39 | ``` 40 | Directory components vuejs to: 41 | ----- 42 | 43 | ``` 44 | assets/ contains assets definition 45 | commands/ contains console commands (controllers) 46 | config/ contains application configurations 47 | controllers/ contains Web controller classes 48 | mail/ contains view files for e-mails 49 | models/ contains model classes 50 | runtime/ contains files generated during runtime 51 | tests/ contains various tests for the basic application 52 | vendor/ contains dependent 3rd-party packages 53 | views/ contains view files for the Web application 54 | assets/ contains assets files 55 | js/ contains js files 56 | components/ contains components vue files 57 | sass/ contains scss files 58 | web/ contains the entry script and Web resources 59 | ``` 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | require 'yaml' 2 | require 'fileutils' 3 | 4 | required_plugins = %w( vagrant-hostmanager vagrant-vbguest ) 5 | required_plugins.each do |plugin| 6 | exec "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin 7 | end 8 | 9 | domains = { 10 | app: 'yii2basic.test' 11 | } 12 | 13 | vagrantfile_dir_path = File.dirname(__FILE__) 14 | 15 | config = { 16 | local: vagrantfile_dir_path + '/vagrant/config/vagrant-local.yml', 17 | example: vagrantfile_dir_path + '/vagrant/config/vagrant-local.example.yml' 18 | } 19 | 20 | # copy config from example if local config not exists 21 | FileUtils.cp config[:example], config[:local] unless File.exist?(config[:local]) 22 | # read config 23 | options = YAML.load_file config[:local] 24 | 25 | # check github token 26 | if options['github_token'].nil? || options['github_token'].to_s.length != 40 27 | puts "You must place REAL GitHub token into configuration:\n/yii2-app-basic/vagrant/config/vagrant-local.yml" 28 | exit 29 | end 30 | 31 | # vagrant configurate 32 | Vagrant.configure(2) do |config| 33 | # select the box 34 | config.vm.box = 'bento/ubuntu-16.04' 35 | 36 | # should we ask about box updates? 37 | config.vm.box_check_update = options['box_check_update'] 38 | 39 | config.vm.provider 'virtualbox' do |vb| 40 | # machine cpus count 41 | vb.cpus = options['cpus'] 42 | # machine memory size 43 | vb.memory = options['memory'] 44 | # machine name (for VirtualBox UI) 45 | vb.name = options['machine_name'] 46 | end 47 | 48 | # machine name (for vagrant console) 49 | config.vm.define options['machine_name'] 50 | 51 | # machine name (for guest machine console) 52 | config.vm.hostname = options['machine_name'] 53 | 54 | # network settings 55 | config.vm.network 'private_network', ip: options['ip'] 56 | 57 | # sync: folder 'yii2-app-advanced' (host machine) -> folder '/app' (guest machine) 58 | config.vm.synced_folder './', '/app', owner: 'vagrant', group: 'vagrant' 59 | 60 | # disable folder '/vagrant' (guest machine) 61 | config.vm.synced_folder '.', '/vagrant', disabled: true 62 | 63 | # hosts settings (host machine) 64 | config.vm.provision :hostmanager 65 | config.hostmanager.enabled = true 66 | config.hostmanager.manage_host = true 67 | config.hostmanager.ignore_private_ip = false 68 | config.hostmanager.include_offline = true 69 | config.hostmanager.aliases = domains.values 70 | 71 | # quick fix for failed guest additions installations 72 | # config.vbguest.auto_update = false 73 | 74 | # provisioners 75 | config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone']] 76 | config.vm.provision 'shell', path: './vagrant/provision/once-as-vagrant.sh', args: [options['github_token']], privileged: false 77 | config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always' 78 | 79 | # post-install message (vagrant console) 80 | config.vm.post_up_message = "App URL: http://#{domains[:app]}" 81 | end 82 | -------------------------------------------------------------------------------- /assets/AppAsset.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 2.0 17 | */ 18 | class AppAsset extends AssetBundle 19 | { 20 | public $basePath = '@webroot'; 21 | public $baseUrl = '@web'; 22 | public $css = [ 23 | 'css/site.css', 24 | ]; 25 | public $js = [ 26 | ]; 27 | public $depends = [ 28 | 'yii\web\YiiAsset', 29 | 'yii\bootstrap\BootstrapAsset', 30 | ]; 31 | } 32 | -------------------------------------------------------------------------------- /codeception.yml: -------------------------------------------------------------------------------- 1 | actor: Tester 2 | bootstrap: _bootstrap.php 3 | paths: 4 | tests: tests 5 | log: tests/_output 6 | data: tests/_data 7 | helpers: tests/_support 8 | settings: 9 | memory_limit: 1024M 10 | colors: true 11 | modules: 12 | config: 13 | Yii2: 14 | configFile: 'config/test.php' 15 | 16 | # To enable code coverage: 17 | #coverage: 18 | # #c3_url: http://localhost:8080/index-test.php/ 19 | # enabled: true 20 | # #remote: true 21 | # #remote_config: '../codeception.yml' 22 | # whitelist: 23 | # include: 24 | # - models/* 25 | # - controllers/* 26 | # - commands/* 27 | # - mail/* 28 | # blacklist: 29 | # include: 30 | # - assets/* 31 | # - config/* 32 | # - runtime/* 33 | # - vendor/* 34 | # - views/* 35 | # - web/* 36 | # - tests/* 37 | -------------------------------------------------------------------------------- /commands/HelloController.php: -------------------------------------------------------------------------------- 1 | 19 | * @since 2.0 20 | */ 21 | class HelloController extends Controller 22 | { 23 | /** 24 | * This command echoes what you have entered as the message. 25 | * @param string $message the message to be echoed. 26 | * @return int Exit code 27 | */ 28 | public function actionIndex($message = 'hello world') 29 | { 30 | echo $message . "\n"; 31 | 32 | return ExitCode::OK; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aki/yii2-app-vue", 3 | "description": "Yii 2 Basic Project Template width VueJs", 4 | "keywords": ["yii2", "framework", "basic", "project template", "vueJs", "yii2-VueJs"], 5 | "homepage": "http://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": "http://www.yiiframework.com/forum/", 11 | "wiki": "http://www.yiiframework.com/wiki/", 12 | "irc": "irc://irc.freenode.net/yii", 13 | "source": "https://github.com/yiisoft/yii2" 14 | }, 15 | "minimum-stability": "stable", 16 | "require": { 17 | "php": ">=5.6.0", 18 | "yiisoft/yii2": "~2.0.14", 19 | "yiisoft/yii2-bootstrap": "~2.0.0", 20 | "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0", 21 | "aki/yii2-vue": "*" 22 | }, 23 | "require-dev": { 24 | "yiisoft/yii2-debug": "~2.1.0", 25 | "yiisoft/yii2-gii": "~2.1.0", 26 | "yiisoft/yii2-faker": "~2.0.0", 27 | "codeception/codeception": "^4.0", 28 | "codeception/verify": "~0.5.0 || ~1.1.0", 29 | "codeception/specify": "~0.4.6", 30 | "symfony/browser-kit": ">=2.7 <=4.2.4", 31 | "codeception/module-filesystem": "^1.0.0", 32 | "codeception/module-yii2": "^1.0.0", 33 | "codeception/module-asserts": "^1.0.0" 34 | }, 35 | "config": { 36 | "process-timeout": 1800, 37 | "fxp-asset": { 38 | "enabled": false 39 | } 40 | }, 41 | "scripts": { 42 | "post-install-cmd": [ 43 | "yii\\composer\\Installer::postInstall" 44 | ], 45 | "post-create-project-cmd": [ 46 | "yii\\composer\\Installer::postCreateProject", 47 | "yii\\composer\\Installer::postInstall" 48 | ] 49 | }, 50 | "extra": { 51 | "yii\\composer\\Installer::postCreateProject": { 52 | "setPermission": [ 53 | { 54 | "runtime": "0777", 55 | "web/assets": "0777", 56 | "yii": "0755" 57 | } 58 | ] 59 | }, 60 | "yii\\composer\\Installer::postInstall": { 61 | "generateCookieValidationKey": [ 62 | "config/web.php" 63 | ] 64 | } 65 | }, 66 | "repositories": [ 67 | { 68 | "type": "composer", 69 | "url": "https://asset-packagist.org" 70 | } 71 | ] 72 | } 73 | -------------------------------------------------------------------------------- /config/console.php: -------------------------------------------------------------------------------- 1 | 'basic-console', 8 | 'basePath' => dirname(__DIR__), 9 | 'bootstrap' => ['log'], 10 | 'controllerNamespace' => 'app\commands', 11 | 'aliases' => [ 12 | '@bower' => '@vendor/bower-asset', 13 | '@npm' => '@vendor/npm-asset', 14 | '@tests' => '@app/tests', 15 | ], 16 | 'components' => [ 17 | 'cache' => [ 18 | 'class' => 'yii\caching\FileCache', 19 | ], 20 | 'log' => [ 21 | 'targets' => [ 22 | [ 23 | 'class' => 'yii\log\FileTarget', 24 | 'levels' => ['error', 'warning'], 25 | ], 26 | ], 27 | ], 28 | 'db' => $db, 29 | ], 30 | 'params' => $params, 31 | /* 32 | 'controllerMap' => [ 33 | 'fixture' => [ // Fixture generation command line. 34 | 'class' => 'yii\faker\FixtureController', 35 | ], 36 | ], 37 | */ 38 | ]; 39 | 40 | if (YII_ENV_DEV) { 41 | // configuration adjustments for 'dev' environment 42 | $config['bootstrap'][] = 'gii'; 43 | $config['modules']['gii'] = [ 44 | 'class' => 'yii\gii\Module', 45 | ]; 46 | } 47 | 48 | return $config; 49 | -------------------------------------------------------------------------------- /config/db.php: -------------------------------------------------------------------------------- 1 | 'yii\db\Connection', 5 | 'dsn' => 'mysql:host=localhost;dbname=yii2basic', 6 | 'username' => 'root', 7 | 'password' => '', 8 | 'charset' => 'utf8', 9 | 10 | // Schema cache options (for production environment) 11 | //'enableSchemaCache' => true, 12 | //'schemaCacheDuration' => 60, 13 | //'schemaCache' => 'cache', 14 | ]; 15 | -------------------------------------------------------------------------------- /config/params.php: -------------------------------------------------------------------------------- 1 | 'admin@example.com', 5 | 'senderEmail' => 'noreply@example.com', 6 | 'senderName' => 'Example.com mailer', 7 | ]; 8 | -------------------------------------------------------------------------------- /config/test.php: -------------------------------------------------------------------------------- 1 | 'basic-tests', 10 | 'basePath' => dirname(__DIR__), 11 | 'aliases' => [ 12 | '@bower' => '@vendor/bower-asset', 13 | '@npm' => '@vendor/npm-asset', 14 | ], 15 | 'language' => 'en-US', 16 | 'components' => [ 17 | 'db' => $db, 18 | 'mailer' => [ 19 | 'useFileTransport' => true, 20 | ], 21 | 'assetManager' => [ 22 | 'basePath' => __DIR__ . '/../web/assets', 23 | ], 24 | 'urlManager' => [ 25 | 'showScriptName' => true, 26 | ], 27 | 'user' => [ 28 | 'identityClass' => 'app\models\User', 29 | ], 30 | 'request' => [ 31 | 'cookieValidationKey' => 'test', 32 | 'enableCsrfValidation' => false, 33 | // but if you absolutely need it set cookie domain to localhost 34 | /* 35 | 'csrfCookie' => [ 36 | 'domain' => 'localhost', 37 | ], 38 | */ 39 | ], 40 | ], 41 | 'params' => $params, 42 | ]; 43 | -------------------------------------------------------------------------------- /config/test_db.php: -------------------------------------------------------------------------------- 1 | 'basic', 8 | 'name' => 'My Yii Vue', 9 | 'basePath' => dirname(__DIR__), 10 | 'bootstrap' => ['log'], 11 | 'aliases' => [ 12 | '@bower' => '@vendor/bower-asset', 13 | '@npm' => '@vendor/npm-asset', 14 | ], 15 | 'components' => [ 16 | 'telegram' => [ 17 | 'class' => 'aki\telegram\Telegram', 18 | 'botToken' => '366300521:AAHNuvVnTEU8zHKglJmLX8QYjAO0ofJkanQ', 19 | ], 20 | 'request' => [ 21 | // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 22 | 'cookieValidationKey' => 'gWw7dT0Ou0iCJp8Nwt2SlOCo5qOU1Pvs', 23 | ], 24 | 'cache' => [ 25 | 'class' => 'yii\caching\FileCache', 26 | ], 27 | 'user' => [ 28 | 'identityClass' => 'app\models\User', 29 | 'enableAutoLogin' => true, 30 | ], 31 | 'errorHandler' => [ 32 | 'errorAction' => 'site/error', 33 | ], 34 | 'mailer' => [ 35 | 'class' => 'yii\swiftmailer\Mailer', 36 | // send all mails to a file by default. You have to set 37 | // 'useFileTransport' to false and configure a transport 38 | // for the mailer to send real emails. 39 | 'useFileTransport' => true, 40 | ], 41 | 'log' => [ 42 | 'traceLevel' => YII_DEBUG ? 3 : 0, 43 | 'targets' => [ 44 | [ 45 | 'class' => 'yii\log\FileTarget', 46 | 'levels' => ['error', 'warning'], 47 | ], 48 | ], 49 | ], 50 | 'db' => $db, 51 | /* 52 | 'urlManager' => [ 53 | 'enablePrettyUrl' => true, 54 | 'showScriptName' => false, 55 | 'rules' => [ 56 | ], 57 | ], 58 | */ 59 | ], 60 | 'params' => $params, 61 | ]; 62 | 63 | if (YII_ENV_DEV) { 64 | // configuration adjustments for 'dev' environment 65 | $config['bootstrap'][] = 'debug'; 66 | $config['modules']['debug'] = [ 67 | 'class' => 'yii\debug\Module', 68 | // uncomment the following to add your IP if you are not connecting from localhost. 69 | //'allowedIPs' => ['127.0.0.1', '::1'], 70 | ]; 71 | 72 | $config['bootstrap'][] = 'gii'; 73 | $config['modules']['gii'] = [ 74 | 'class' => 'yii\gii\Module', 75 | // uncomment the following to add your IP if you are not connecting from localhost. 76 | //'allowedIPs' => ['127.0.0.1', '::1'], 77 | ]; 78 | } 79 | 80 | return $config; 81 | -------------------------------------------------------------------------------- /controllers/SiteController.php: -------------------------------------------------------------------------------- 1 | [ 22 | 'class' => AccessControl::className(), 23 | 'only' => ['logout'], 24 | 'rules' => [ 25 | [ 26 | 'actions' => ['logout'], 27 | 'allow' => true, 28 | 'roles' => ['@'], 29 | ], 30 | ], 31 | ], 32 | 'verbs' => [ 33 | 'class' => VerbFilter::className(), 34 | 'actions' => [ 35 | 'logout' => ['post'], 36 | ], 37 | ], 38 | ]; 39 | } 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | public function actions() 45 | { 46 | return [ 47 | 'error' => [ 48 | 'class' => 'yii\web\ErrorAction', 49 | ], 50 | 'captcha' => [ 51 | 'class' => 'yii\captcha\CaptchaAction', 52 | 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, 53 | ], 54 | ]; 55 | } 56 | 57 | /** 58 | * Displays homepage. 59 | * 60 | * @return string س 61 | */ 62 | public function actionIndex() 63 | { 64 | return $this->render('index'); 65 | } 66 | 67 | } -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | php: 4 | image: yiisoftware/yii2-php:7.1-apache 5 | volumes: 6 | - ~/.composer-docker/cache:/root/.composer/cache:delegated 7 | - ./:/app:delegated 8 | ports: 9 | - '8000:80' -------------------------------------------------------------------------------- /mail/layouts/html.php: -------------------------------------------------------------------------------- 1 | 8 | beginPage() ?> 9 | 10 | 11 |
12 | 13 |The path to yii framework seems to be incorrect.
\n" 34 | . 'You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . ".
\n" 35 | . 'Please refer to the README on how to install Yii.
\n"; 36 | 37 | if (!empty($_SERVER['argv'])) { 38 | // do not print HTML when used in console mode 39 | echo strip_tags($message); 40 | } else { 41 | echo $message; 42 | } 43 | exit(1); 44 | } 45 | 46 | require_once($frameworkPath . '/requirements/YiiRequirementChecker.php'); 47 | $requirementsChecker = new YiiRequirementChecker(); 48 | 49 | $gdMemo = $imagickMemo = 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.'; 50 | $gdOK = $imagickOK = false; 51 | 52 | if (extension_loaded('imagick')) { 53 | $imagick = new Imagick(); 54 | $imagickFormats = $imagick->queryFormats('PNG'); 55 | if (in_array('PNG', $imagickFormats)) { 56 | $imagickOK = true; 57 | } else { 58 | $imagickMemo = 'Imagick extension should be installed with PNG support in order to be used for image CAPTCHA.'; 59 | } 60 | } 61 | 62 | if (extension_loaded('gd')) { 63 | $gdInfo = gd_info(); 64 | if (!empty($gdInfo['FreeType Support'])) { 65 | $gdOK = true; 66 | } else { 67 | $gdMemo = 'GD extension should be installed with FreeType support in order to be used for image CAPTCHA.'; 68 | } 69 | } 70 | 71 | /** 72 | * Adjust requirements according to your application specifics. 73 | */ 74 | $requirements = array( 75 | // Database : 76 | array( 77 | 'name' => 'PDO extension', 78 | 'mandatory' => true, 79 | 'condition' => extension_loaded('pdo'), 80 | 'by' => 'All DB-related classes', 81 | ), 82 | array( 83 | 'name' => 'PDO SQLite extension', 84 | 'mandatory' => false, 85 | 'condition' => extension_loaded('pdo_sqlite'), 86 | 'by' => 'All DB-related classes', 87 | 'memo' => 'Required for SQLite database.', 88 | ), 89 | array( 90 | 'name' => 'PDO MySQL extension', 91 | 'mandatory' => false, 92 | 'condition' => extension_loaded('pdo_mysql'), 93 | 'by' => 'All DB-related classes', 94 | 'memo' => 'Required for MySQL database.', 95 | ), 96 | array( 97 | 'name' => 'PDO PostgreSQL extension', 98 | 'mandatory' => false, 99 | 'condition' => extension_loaded('pdo_pgsql'), 100 | 'by' => 'All DB-related classes', 101 | 'memo' => 'Required for PostgreSQL database.', 102 | ), 103 | // Cache : 104 | array( 105 | 'name' => 'Memcache extension', 106 | 'mandatory' => false, 107 | 'condition' => extension_loaded('memcache') || extension_loaded('memcached'), 108 | 'by' => 'MemCache', 109 | 'memo' => extension_loaded('memcached') ? 'To use memcached set MemCache::useMemcached totrue
.' : ''
110 | ),
111 | // CAPTCHA:
112 | array(
113 | 'name' => 'GD PHP extension with FreeType support',
114 | 'mandatory' => false,
115 | 'condition' => $gdOK,
116 | 'by' => 'Captcha',
117 | 'memo' => $gdMemo,
118 | ),
119 | array(
120 | 'name' => 'ImageMagick PHP extension with PNG support',
121 | 'mandatory' => false,
122 | 'condition' => $imagickOK,
123 | 'by' => 'Captcha',
124 | 'memo' => $imagickMemo,
125 | ),
126 | // PHP ini :
127 | 'phpExposePhp' => array(
128 | 'name' => 'Expose PHP',
129 | 'mandatory' => false,
130 | 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
131 | 'by' => 'Security reasons',
132 | 'memo' => '"expose_php" should be disabled at php.ini',
133 | ),
134 | 'phpAllowUrlInclude' => array(
135 | 'name' => 'PHP allow url include',
136 | 'mandatory' => false,
137 | 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
138 | 'by' => 'Security reasons',
139 | 'memo' => '"allow_url_include" should be disabled at php.ini',
140 | ),
141 | 'phpSmtp' => array(
142 | 'name' => 'PHP mail SMTP',
143 | 'mandatory' => false,
144 | 'condition' => strlen(ini_get('SMTP')) > 0,
145 | 'by' => 'Email sending',
146 | 'memo' => 'PHP mail SMTP server required',
147 | ),
148 | );
149 |
150 | // OPcache check
151 | if (!version_compare(phpversion(), '5.5', '>=')) {
152 | $requirements[] = array(
153 | 'name' => 'APC extension',
154 | 'mandatory' => false,
155 | 'condition' => extension_loaded('apc'),
156 | 'by' => 'ApcCache',
157 | );
158 | }
159 |
160 | $result = $requirementsChecker->checkYii()->check($requirements)->getResult();
161 | $requirementsChecker->render();
162 | exit($result['summary']['errors'] === 0 ? 0 : 1);
163 |
--------------------------------------------------------------------------------
/runtime/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
--------------------------------------------------------------------------------
/tests/_bootstrap.php:
--------------------------------------------------------------------------------
1 | amOnPage(Url::toRoute('/site/about'));
10 | $I->see('About', 'h1');
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/tests/acceptance/ContactCest.php:
--------------------------------------------------------------------------------
1 | amOnPage(Url::toRoute('/site/contact'));
10 | }
11 |
12 | public function contactPageWorks(AcceptanceTester $I)
13 | {
14 | $I->wantTo('ensure that contact page works');
15 | $I->see('Contact', 'h1');
16 | }
17 |
18 | public function contactFormCanBeSubmitted(AcceptanceTester $I)
19 | {
20 | $I->amGoingTo('submit contact form with correct data');
21 | $I->fillField('#contactform-name', 'tester');
22 | $I->fillField('#contactform-email', 'tester@example.com');
23 | $I->fillField('#contactform-subject', 'test subject');
24 | $I->fillField('#contactform-body', 'test content');
25 | $I->fillField('#contactform-verifycode', 'testme');
26 |
27 | $I->click('contact-button');
28 |
29 | $I->wait(2); // wait for button to be clicked
30 |
31 | $I->dontSeeElement('#contact-form');
32 | $I->see('Thank you for contacting us. We will respond to you as soon as possible.');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/tests/acceptance/HomeCest.php:
--------------------------------------------------------------------------------
1 | amOnPage(Url::toRoute('/site/index'));
10 | $I->see('My Company');
11 |
12 | $I->seeLink('About');
13 | $I->click('About');
14 | $I->wait(2); // wait for page to be opened
15 |
16 | $I->see('This is the About page.');
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/acceptance/LoginCest.php:
--------------------------------------------------------------------------------
1 | amOnPage(Url::toRoute('/site/login'));
10 | $I->see('Login', 'h1');
11 |
12 | $I->amGoingTo('try to login with correct credentials');
13 | $I->fillField('input[name="LoginForm[username]"]', 'admin');
14 | $I->fillField('input[name="LoginForm[password]"]', 'admin');
15 | $I->click('login-button');
16 | $I->wait(2); // wait for button to be clicked
17 |
18 | $I->expectTo('see user info');
19 | $I->see('Logout');
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/acceptance/_bootstrap.php:
--------------------------------------------------------------------------------
1 | [
21 | 'db' => require __DIR__ . '/../../config/test_db.php'
22 | ]
23 | ]
24 | );
25 |
26 |
27 | $application = new yii\console\Application($config);
28 | $exitCode = $application->run();
29 | exit($exitCode);
30 |
--------------------------------------------------------------------------------
/tests/bin/yii.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | rem -------------------------------------------------------------
4 | rem Yii command line bootstrap script for Windows.
5 | rem
6 | rem @author Qiang Xue 7 | You have successfully created your Yii-powered application. 8 |
9 |10 | Get started with Yii 13 |
14 |14 | This is the About page. You may modify the following file to customize its content: 15 |
16 | 17 |= __FILE__ ?>
18 |
24 | Note that if you turn on the Yii debugger, you should be able
25 | to view the mail message on the mail panel of the debugger.
26 | mailer->useFileTransport): ?>
27 | Because the application is in development mode, the email is not sent but saved as
28 | a file under = Yii::getAlias(Yii::$app->mailer->fileTransportPath) ?>
.
29 | Please configure the useFileTransport
property of the mail
30 | application component to be false to enable email sending.
31 |
32 |
37 | If you have business inquiries or other questions, please fill out the following form to contact us. 38 | Thank you. 39 |
40 | 41 |21 | The above error occurred while the Web server was processing your request. 22 |
23 |24 | Please contact us if you think this is a server error. Thank you. 25 |
26 | 27 |Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et 20 | dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip 21 | ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu 22 | fugiat nulla pariatur.
23 | 24 | 25 |Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et 30 | dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip 31 | ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu 32 | fugiat nulla pariatur.
33 | 34 | 35 |Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et 40 | dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip 41 | ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu 42 | fugiat nulla pariatur.
43 | 44 | 45 |Please fill out the following fields to login:
17 | 18 | 'login-form', 20 | 'layout' => 'horizontal', 21 | 'fieldConfig' => [ 22 | 'template' => "{label}\napp\models\User::$users
.
46 |