DEV Community

Ariel Mejia
Ariel Mejia

Posted on • Updated on

Install Laravel Valet

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)"
Enter fullscreen mode Exit fullscreen mode

Install PHP

Copy and paste the code in the terminal:

brew install php
Enter fullscreen mode Exit fullscreen mode

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');"
Enter fullscreen mode Exit fullscreen mode

Move composer.phar to local user’s bin folder

Copy and paste this command:

mv composer.phar /usr/local/bin/composer
Enter fullscreen mode Exit fullscreen mode

Now you are can type composer on terminal and you will find the options from composer.

Require Valet

composer global require laravel/valet
Enter fullscreen mode Exit fullscreen mode

Move valet

PATH=$PATH:~/.composer/vendor/bin
Enter fullscreen mode Exit fullscreen mode

Install Valet

valet install
Enter fullscreen mode Exit fullscreen mode

Serving sites

Create a directory for your Laravel Valet projects

mkdir Developer
Enter fullscreen mode Exit fullscreen mode

Inside the "Developer" directory execute the park command:

valet park
Enter fullscreen mode Exit fullscreen mode

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:

DBngin link 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:

TablePlus

Sequel Pro

Install Laravel installer

To create new projects easily with Laravel you can download the laravel installer:

composer global require laravel/installer
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

If you are using zsh run these commands:

echo 'PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH' >> ~/.zshrc

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Then you are able to create new project with Laravel on terminal easily, inside your "Developer" directory type:

laravel new example
Enter fullscreen mode Exit fullscreen mode

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 repository

  • laravel 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 jetstream

  • laravel 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.

Top comments (0)