Install via Composer
Spin can be installed using Composer, a popular PHP package manager. This enables you to make Spin accessible without other developers doing any steps on their end.
Add spin
to your project with Composer
Installing spin
at the project level is a great way to deploy spin
without much configuration from the user's end. View spin
on Packagist →
We can use Docker to run composer
and install it on your project. Run this command from the parent folder of your project.
Install `spin` with Composer
docker run --rm -it -v $(pwd):/app composer require serversideup/spin --dev
Spin is installed 🥳
You should now be able to access spin
by running:
Confirm Spin is working
bash vendor/bin/spin version
Bonus Tip: Use an alias
Rather than typing vendor/bin/spin
every time, you can add a "smart alias", which will check to see if it exists in your node_modules
, if not, it loads it from the vendor
folder.
You can add the following below to your ~/.bash_profile
or your ~/.zshrc
.
Add to your shell profile (recommended)
alias spin='[ -f node_modules/.bin/spin ] && bash node_modules/.bin/spin || bash vendor/bin/spin'
You'll now be able to access spin
from your project root directory.
Initialize Your Project
Once Spin is installed, you can follow the initialization wizard for your project by running spin init
.
Initialize Spin with your project
spin init