Skip to content

Latest commit

 

History

History
196 lines (137 loc) · 4.57 KB

installation.md

File metadata and controls

196 lines (137 loc) · 4.57 KB

Installation

Table of contents

Before you begin

If you do not have Composer, you may install it by following the instructions at getcomposer.org.

It uses asset-packagist for managing bower and npm package dependencies through Composer. Also you can use asset-plugin, as in earlier versions, but it works slowly.

Get source code via Composer

You can install this application template with composer using the following command:

composer create-project --prefer-dist --stability=dev beaten-sect0r/yii2-core

Get source code

Download sources

https://github.com/Beaten-Sect0r/yii2-core/archive/master.zip

Or clone repository manually

git clone https://github.com/Beaten-Sect0r/yii2-core.git

Install composer dependencies

composer install --prefer-dist

Manual installation

Requirements

The minimum requirement by this project template is that your Web server supports PHP 5.4.0.

Setup application

  1. Copy .env.dist to .env in the project root.

  2. 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=localhost;port=3306;dbname=yii2-core
    DB_USERNAME = user
    DB_PASSWORD = password
    
    • Set application canonical urls
    FRONTEND_URL = http://yii2-core.loc
    BACKEND_URL = http://backend.yii2-core.loc
    STORAGE_URL = http://storage.yii2-core.loc
    
  3. Run in command line

php yii app/setup

Authentication

administrator role account

Login: Administrator
Password: passwd

Configure your web server

Or configure your web server with three different web roots:

  • yii2-core.loc => /path/to/yii2-core/frontend/web
  • backend.yii2-core.loc => /path/to/yii2-core/backend/web
  • storage.yii2-core.loc => /path/to/yii2-core/storage

Single domain installation

Setup application

Adjust settings in .env file

FRONTEND_URL = http://yii2-core.loc
BACKEND_URL = http://yii2-core.loc/backend
STORAGE_URL = http://yii2-core.loc/storage

Adjust settings in backend/config/main.php file

    ...
    'components'=>[
        ...
        'request' => [
            'baseUrl' => '/backend',
        ...

Adjust settings in frontend/config/main.php file

    ...
    'components'=>[
        ...
        'request' => [
            'baseUrl' => '',
        ...

Configure your web server

Apache

Single domain .htaccess for apache

# Set the default charset.
AddDefaultCharset UTF-8

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Enable symlinks
Options +FollowSymlinks

# Enable mod_rewrite
RewriteEngine On

# Backend redirect
RewriteCond %{REQUEST_URI} ^/backend
RewriteRule ^backend/(.*)$ backend/web/$1 [L]

# Storage redirect
RewriteCond %{REQUEST_URI} ^/storage
RewriteRule ^storage/(.*)$ storage/$1 [L]

# Frontend redirect
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteRule ^(.*)$ frontend/web/$1

Video instruction

https://www.youtube.com/watch?v=XAC5joagA70

Vagrant installation

This way is the easiest but long (~20 min).

This installation way doesn't require pre-installed software (such as web-server, PHP, MySQL etc.) - just do next steps!

  1. Install VirtualBox

  2. Install Vagrant

  3. Create GitHub personal API token

  4. Copy vagrant-local.example.yml to vagrant-local.yml

  5. Place your GitHub personal API token to vagrant-local.yml

  6. Run commands:

    cd yii2-core
    vagrant plugin install vagrant-hostmanager
    vagrant up

That's all. You just need to wait for completion! After that you can access project locally by URLs: