Skip to content

Scalingo/sample-php-yii2

Repository files navigation

sample-php-yii2

Dev env

Install with Docker

Update your vendor packages

docker-compose run --rm php composer update --prefer-dist

Run the installation triggers (creating cookie validation code)

docker-compose run --rm php composer install

Start the container

docker-compose up -d

You can then access the application through the following URL:

http://127.0.0.1:8000

NOTES:

  • Minimum required Docker engine version 17.04 for development (see Performance tuning for volume mounts)
  • The default configuration uses a host-volume in your home directory .docker-composer for composer caches

CONFIGURATION

Database

Edit the file config/db.php with real data, for example:

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2basic',
    'username' => 'root',
    'password' => '1234',
    'charset' => 'utf8',
];

NOTES:

  • Yii won't create the database for you, this has to be done manually before you can access it.
  • Check and edit the other files in the config/ directory to customize your application as required.