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

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

Laravel Certification Prelude

The Laravel Certification exam is here and I'm taking it.

Serving static content in Laravel Valet

Check out my custom valet driver for prototyping outside of a framework.

Aligning content in a grid using Vue

A Vue plugin to ensure grid content pleases the eye.

Validating payment details in Vue

A simple Vue plugin to validate card details