2017 © Pedro Peláez
 

yii2-extension install

Project installation support extension for the Yii2 framework

image

yii2tech/install

Project installation support extension for the Yii2 framework

  • Friday, March 2, 2018
  • by klimov-paul
  • Repository
  • 3 Watchers
  • 14 Stars
  • 830 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

, (*1)

Install Extension for Yii 2


This extension provides ability for automated initialization of the project working copy, including local directories and files creation, running DB migrations and so on., (*2)

For license information check the LICENSE-file., (*3)

Latest Stable Version Total Downloads Build Status, (*4)

Requirements

This extension requires Linux OS., (*5)

Installation

The preferred way to install this extension is through composer., (*6)

Either run, (*7)

php composer.phar require --prefer-dist yii2tech/install

or add, (*8)

"yii2tech/install": "*"

to the require section of your composer.json., (*9)

If you wish to setup crontab during project installation, you will also need to install yii2tech/crontab, which is not required by default. In order to do so either run, (*10)

php composer.phar require --prefer-dist yii2tech/crontab

or add, (*11)

"yii2tech/crontab": "*"

to the require section of your composer.json., (*12)

Usage

This extension provides special console controller [[yii2tech\install\InitController]], which allows initialization of the project working copy. Such initialization includes:, (*13)

  • check if current environment matches project requirements.
  • create local directories (the ones, which may be not stored in version control system) and make them write-able.
  • create local files, such as configuration files, from templates.
  • run extra shell commands, like 'yii migrate' command.
  • setup cron jobs.

In order to create an installer, you should create a separated console application entry script. This script should be absolutely stripped from the local configuration files, database and so on! See examples/install.php for the example of such script., (*14)

Once you have such script you can run installation process, using following command:, (*15)

php install.php init

Working with local files

The most interesting feature introduced by [[yii2tech\install\InitController]] is creating local project files, such as configuration files, from thier examples in interactive mode. For each file, which content may vary depending on actual project environment, you should create a template file named in format {filename}.sample. This file should be located under the same directory, where the actual local file should appear. Inside the template file you can use placeholders in format: {{placeholderName}}. For example:, (*16)

defined('YII_DEBUG') or define('YII_DEBUG', {{yiiDebug}});
defined('YII_ENV') or define('YII_ENV', '{{yiiEnv}}');

return [
    'components' => [
        'db' => [
            'dsn' => 'mysql:host={{dbHost}};dbname={{dbName}}',
            'username' => '{{dbUser}}',
            'password' => '{{dbPassword}}',
        ],
    ],
];

While being processed, file templates are parsed, and for all found placeholders user will be asked to enter a value for them. You can make this process more user-friendly by setting [[yii2tech\install\InitController::localFilePlaceholders]], specifying hints, type and validation rules. See [[yii2tech\install\LocalFilePlaceholder]] for more details., (*17)

Non interactive installation

Asking user for particular placeholder value may be not efficient and sometimes not acceptable. You may need to run project intallation in fully automatic mode without user input, for example after updating source code from version control system inside automatic project update. In order to disable any user-interaction, you should use interactive option:, (*18)

php install.php init --interactive=0

In this mode for all local file placeholders the default values will be taken, but only in case such values are explicitely defined via [[yii2tech\install\InitController::localFilePlaceholders]]. Because install entry script usually stored under version control system and local file placeholder values (as well as other installation parameters) may vary depending on particular environment, [[yii2tech\install\InitController]] instroduce 'config' option. Using this option you may specify extra configuration file, which should be merged with predefined parameters. In order to create such configuration file, you can use following:, (*19)

php install.php init/config @app/config/install.php

Once you have adjusted created configuration file, you can run installation with it:, (*20)

php install.php init --config=@app/config/install.php --interactive=0

The Versions

02/03 2018

2.0.x-dev

2.0.9999999.9999999-dev

Project installation support extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

yii2 install init local file

02/03 2018

dev-master

9999999-dev

Project installation support extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

yii2 install init local file

02/03 2018

1.0.3

1.0.3.0

Project installation support extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

yii2 install init local file

12/01 2017

1.0.2

1.0.2.0

Project installation support extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

yii2 install init local file

10/02 2016

1.0.1

1.0.1.0

Project installation support extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

yii2 install init

29/12 2015

1.0.0

1.0.0.0

Project installation support extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

yii2 install init