Setup Yii
Setup Yii
This example installs a Yii 2.x application with Composer from inside the Devilbox PHP container.
example yii documentation
Overview
The following configuration will be used:
| Project name | VirtualHost directory | Database | TLD_SUFFIX | Project URL |
|---|---|---|---|---|
| my-yii | /shared/httpd/my-yii | n.a. | loc | http://my-yii.loc br https://my-yii.loc |
[!NOTE] Inside the Devilbox PHP container, projects are always in
/shared/httpd/. On your host, projects are stored in./data/www/by default. This path can be changed viaenv-httpd-datadir.
Walk through
It will be ready in six steps:
- Start Devilbox
- Enter the PHP container
- Create a new VirtualHost directory
- Install Yii 2.x via Composer
- Symlink the webroot directory
- Configure DNS and open the site
1. Start Devilbox
host> ./dvl.sh up2. Enter the PHP container
All work will be done inside the PHP container:
host> ./dvl.sh shell* enter-the-php-container * work-inside-the-php-container *
available-tools
3. Create new vhost directory
The vhost directory defines the name under which your project will be available.
env-tld-suffix
4. Install Yii 2.x
Install the Yii 2 basic application template:
[email protected] in /shared/httpd/my-yii $ composer create-project --prefer-dist yiisoft/yii2-app-basic yii2How the directory structure looks after installation:
.└── yii2
1 directory, 0 files5. Symlink webroot
The web server expects every project document root in <vhost dir>/htdocs/.
Yii keeps its entry point in web/, so symlink it to htdocs:
.├── yii2└── htdocs -> yii2/web
2 directories, 0 files6. DNS record and browser
If Auto DNS is configured you can skip the hosts entry. Otherwise add this line to your host operating system’s hosts file:
127.0.0.1 my-yii.locOpen http://my-yii.loc or https://my-yii.loc to see the Yii welcome page.
howto-add-project-hosts-entry-on-machowto-add-project-hosts-entry-on-winsetup-auto-dns
Next steps
Use bundled batteries
* devilbox-intranet-adminer * devilbox-intranet-phpmyadmin *
devilbox-intranet-phppgadmin * devilbox-intranet-phpredmin *
devilbox-intranet-phpmemcachedadmin
Enhance the Devilbox
* setup-valid-https * setup-auto-dns * configure-php-xdebug
Add services
custom-container-enable-blackfirecustom-container-enable-rabbitmqcustom-container-enable-solrcustom-container-enable-varnish