Use docker for laravel development environment. By the way, we will introduce how to use laravel to set up the docker container cost commands. Laravel is one of the most popular php development frameworks in 2015.
I have some similar introductions on the Internet, but I think I should write one myself.
Create a file and grant the executable permission. The objective is to run the coomposer image as a local command.
$ cat /usr/local/bin/composer
! /Bin/sh
Export PATH =/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
Echo "Current working directory: '" $ (pwd )"'"
Docker run -- rm-v $ (pwd):/app-v ~ /. Ssh:/root/. ssh composer/composer $ @
$ Chmod + x/usr/local/bin/composer
Check whether the PATH of the environment variable contains/usr/local/bin.
Of course, you can also use the alias method
alias composer="docker run --rm -v $(pwd):/app -v ~/.ssh:/root/.ssh composer/composer"
Create a composer. json requirement Template
$ cat composer.json{"require": { "laravel/installer": ">=1.3.3"}}
Install the laravel environment
composer install
In fact, at this time, the/usr/local/bin/composer is run, and the composer/composer image is called in the script.
Create the first project
$ composer create-project --prefer-dist laravel/laravel blog...phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)Writing lock fileGenerating autoload files> Illuminate\Foundation\ComposerScripts::postUpdate> php artisan optimizeGenerating optimized class loader
The APP_KEY is automatically updated. If there is no update, you can manually update it.
$ cd blog$ php artisan key:generate
Start the php Server
$ cd blog/public$ php -S localhost:8000
Then you can see the initial laravel website.