Snippets
Local Environment Setup
Note $
represents a terminal command and should not be typed out.
All commands (unless otherwise specified) should be ran from home dir:
$ cd
- Update or Install Homebrew
- Install PHP
- Install MySQL
- Install Composer
- Install Node/NPM
- Install Valet
- Serve Up Your Sites
Update or Install Homebrew
Install
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
OR
Update
$ brew update
Install PHP
$ brew install homebrew/php/php71
7.1 was latest at the time. Check for latest release or the recommended version on the valet docs.
Install MySQL
$ brew install mysql
$ brew services start mysql
You can download Sequel Pro and connect to your local MySQL server.
- Host: 127.0.0.1
- User: root
Leave everything else blank and connect.
Install Composer
Download
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
$ php composer-setup.php
$ php -r "unlink('composer-setup.php');"
Install Globally
$ mv composer.phar /usr/local/bin/composer
Add to your Path
$ sudo vim /etc/paths
- You can use any method of editing the file
- Add
/users/{your-folder-name}/.composer/vendor/bin
at the bottom of the file and save - Quit/restart terminal
Install Node/NPM
$ brew install node
$ node -v
$ npm -v
Commands 2 and 3 should return the versions of Node and NPM if install properly.
Valet Installer
$ composer global require laravel/valet
Laravel Installer
$ composer global require laravel/installer
Install Valet
$ valet install
This will most likely prompt for the root password
Serve up your sites
Read the valet documentation on serving sites.
If you already have a pretty good size projects folder I would recommend linking your project individually OR creating a separate directory inside your projects folder specifically for valet sites.
Serving in a nutshell
Park entire directory
$ cd ~/projects
$ mkdir valet && cd valet
$ valet park
Every directory in the newly created valet
directory will be automatically accessible at directory-name.dev
.
Link single directory
$ cd ~/projects
$ mkdir app-name && cd app-name
$ valet link app-name
The site will now be available at app-name.dev
.
Comments (0)
You can clone a snippet to your computer for local editing. Learn more.