-
If you do not have Composer, you may install it by following the instructions at getcomposer.org.
-
Install NPM or Yarn to build frontend scripts
- [NPM] (https://docs.npmjs.com/getting-started/installing-node)
- Yarn (https://yarnpkg.com/en/docs/install)
https://github.com/trntv/yii2-starter-kit/archive/master.zip
git clone https://github.com/trntv/yii2-starter-kit.git
composer install
You can install this application template with composer
using the following command:
composer create-project --prefer-dist --stability=dev trntv/yii2-starter-kit
- Install docker and docker-compose to your system
- Run
composer run-script docker:build
- That's all - your application is accessible on http://yii2-starter-kit.localhost
-
- docker host IP address may vary on Windows and MacOS systems
PS Also you can use bash inside application container. To do so run docker-compose exec app bash
- How do i run yii console commands from outside a container?
docker-compose exec app console/yii help
docker-compose exec app console/yii migrate
docker-compose exec app console/yii rbac-migrate
- How to connect to the application database with my workbench, navicat etc?
MySQL is available on
yii2-starter-kit.localhost
, port3306
. User -root
, password -root
The minimum requirement by this application template that your Web server supports PHP 5.6.0. Required PHP extensions:
- intl
- gd
- mcrypt
- com_dotnet (for Windows)
-
Copy
.env.dist
to.env
in the project root. -
Adjust settings in
.env
file- Set debug mode and your current environment
YII_DEBUG = true YII_ENV = dev
- Set DB configuration
DB_DSN = mysql:host=127.0.0.1;port=3306;dbname=yii2-starter-kit DB_USERNAME = user DB_PASSWORD = password
- Set application canonical urls
FRONTEND_HOST_INFO = http://yii2-starter-kit.localhost BACKEND_HOST_INFO = http://backend.yii2-starter-kit.localhost STORAGE_HOST_INFP = http://storage.yii2-starter-kit.localhost
-
Run in command line
php console/yii app/setup
npm install
npm run build
- Copy
docker/vhost.conf
to your nginx config directory - Change it to fit your environment
If you want, you can use bundled Vagrant instead of installing app to your local machine.
- Install Vagrant
- Copy files from
docs/vagrant-files
to application root - Copy
./vagrant/vagrant.yml.dist
to./vagrant/vagrant.yml
- Create GitHub personal API token
- Edit values as desired including adding the GitHub personal API token to
./vagrant/vagrant.yml
- Run:
vagrant plugin install vagrant-hostmanager
vagrant up
That`s all. After provision application will be accessible on http://yii2-starter-kit.localhost
Login: webmaster
Password: webmaster
Login: manager
Password: manager
Login: user
Password: user
- Setup application
Adjust settings in
.env
file
FRONTEND_BASE_URL = /
BACKEND_BASE_URL = /backend/web
STORAGE_BASE_URL = /storage/web
- Adjust settings in
backend/config/web.php
file
...
'components'=>[
...
'request' => [
'baseUrl' => '/admin',
...
- Adjust settings in
frontend/config/web.php
file
...
'components'=>[
...
'request' => [
'baseUrl' => '',
...
- Configure your web server Example of single domain config for nginx can be found here
- There is a VirtualBox bug related to sendfile that can lead to corrupted files, if not turned-off
Uncomment this in your nginx config if you are using Vagrant:
sendfile off;