Helpful Laravel Valet aliases


Quick post. Just wanted to share some of my custom aliases to aid development using Laravel Valet as your dev server. It assumes a convention of using the mysql service for your databases, and a docker-compose-valet.yml file in the root of your project for project dependencies outside the remit of Valet. Aliases can of course be modified for your needs.

Simply add the following to your .bash_profile, .zshrc or other shell config of choice:

# Valet Up
vup() {
    # Start Valet
    valet start
    # Start MySql
    brew services start mysql
    # If a valet Dockerfile is present, run as daemon
    if [ -f docker-compose-valet.yml ]; then
        echo "👍    \e[4m\e[42m\e[30mValet Dockerfile found, running as daemon...\e[0m"
        docker-compose --file docker-compose-valet.yml up -d
    fi
}

# Valet Down
vdown() {
    # Stop Valet
    valet stop
    # Stop MySql
    brew services stop mysql
    # If a valet dockerfile exists then stop it
    if [ -f docker-compose-valet.yml ]; then
        echo "👍    \e[4m\e[42m\e[30mValet Dockerfile found, stopping...\e[0m"
        docker-compose --file docker-compose-valet.yml stop
    fi
}

If you have any ideas of how to improve the aliases, please do create a PR on the Github repository. Please share and star ⭐️ on Github if you found it useful!

Related Posts

New package - Nuxt Lighthouse Module

Implementing automated Lighthouse audits on each deploy of your Nuxt.js application.

New package - Storybook Directories

A simple module for generating your storybook story structure based on your directory structure.

Gitprefix - Automatically formatting commit messages

Git precommit hook for appending branch and emoji prefixes

Automated Pull Request Checks on Github

Using Probot to create automated checks on Github Pull Requests

Netsells 💙 Vue (+ Vue.js London)

Why we at Netsells love the Vue.js framework and where you can find us later this week

Maximising Productivity with Slack

Staying productive with your favourite workplace chat app

Stop with the unhelpful loading spinners

Give some context to your users with some helpful loading text

Responsive Blocks and Vertical Alignment

How to create responsive cross-browser blocks with vertically aligned content

Development Goals for 2018

New Year Promise.resolve()

Progressively Infiltrating Google

Attending the Google Academy for a course on Progressive Web Apps