Ariel Mejia
Posted on June 19, 2021
Install Brew
You can install brew typing the code from the official homebrew page: here or copy and paste this code in the terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install PHP
Copy and paste the code in the terminal:
brew install php
Install composer
Copy and paste the code in the terminal:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Move composer.phar to local user’s bin folder
Copy and paste this command:
mv composer.phar /usr/local/bin/composer
Now you are can type composer on terminal and you will find the options from composer.
Require Valet
composer global require laravel/valet
Move valet
PATH=$PATH:~/.composer/vendor/bin
Install Valet
valet install
Serving sites
Create a directory for your Laravel Valet projects
mkdir Developer
Inside the "Developer" directory execute the park command:
valet park
Install DBngin
Almost every Laravel application needs a database to persist data, DBngin is free management tool, it works with mysql
redis
, postgres
and more, it also install the engine needed for you so you do not need to worry about more installation process, just download from here:
Install TablePlus or SequelPro
You are now able to install database engines and create connections with DBngin, but to visualize, handle and create databases you can use a software to make the database handle easier, SequelPro is free and TablePlus has a free version with some limitations but support multiple Database engines, so choose what makes sense for you:
Install Laravel installer
To create new projects easily with Laravel you can download the laravel installer:
composer global require laravel/installer
Place Composer's system-wide vendor bin directory in your $PATH
Change the bash_profile file:
If you are using bash in your terminal, run these commands:
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc
source ~/.bashrc
If you are using zsh run these commands:
echo 'PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH' >> ~/.zshrc
source ~/.zshrc
Then you are able to create new project with Laravel on terminal easily, inside your "Developer" directory type:
laravel new example
Then it creates a new laravel project as "example" inside your "Developer" folder.
You should double check by deleting the terminal session and start a new one, create another example project, just to check that the laravel installer works.
Visit your site
Now you can go to the browser and type: example.test
and you will find your corresponding laravel project.
More commands
Optionally you can add flags to the laravel new example
command, like:
laravel new example --git
creates the project and initialize a git file.laravel new example --github
creates the project, the git repo and a corresponding private github repositorylaravel new example --github="public"
, the same but creating a public github repository.laravel new example --github --organization="your-github-organization-name"
it creates the project, initialize git, and creates the corresponding private repository on github organization.laravel new example --jet
creates a laravel project with jetstreamlaravel new example --jet --teams
creates a new laravel project with jetstream and teams feature.
This are some examples of the laravel installer command flags.
And now you have a complete local development setup to work with Laravel, thanks for reading.
Posted on June 19, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.