To achive our goal we will use composer from official docker container.
Of course using docker image will require us to write very long shell commands, but that can be avoid adding the following snippet to our .bashrc or .zshrc*.
- Go to your .bashrc and copy paste the following function at the end of the file.
~ $ nano ~/.bashrc
...
# composer function starts
composer () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/app \
composer "$@"
}
# composer function ends
Exit using Ctrl + x.
- Now you need to restart your bash session closing the terminal or you can use the following command.
~ $ source ~ /.bashrc
- Create the project
~ $ composer create-project symfony/framework-standard-edition project_name 3.4.*