Composer not installed on the machine, it can be run with a docker: docker run
How can run in any directory it, bash can define the function of:
- Create a directory on the host, to save the composer's configuration and cache files:
mkdir ~/dnmp/composer
- Open the host
~/.bashrc
or~/.zshrc
file, add the following:
composer () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume ~/dnmp/composer:/tmp \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/app \
composer "$@"
}
- Let onset file:
source ~/.bashrc
- In any directory on your host will be able to use
composer
the:
cd ~/dnmp/www/
composer create-project yeszao/fastphp project --no-dev
- (Optional) If prompted to rely on, a
--ignore-platform-reqs
--no-scripts
closed-dependent detection. - (Optional) for the first time
composer
will~/dnmp/composer
generate a directoryconfig.json
file, you can specify the domestic warehouse in this file, for example:
{
"config": {},
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.laravel-china.org"
}
}
}