Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Minimal Dev (June 2017)

The Minimal Dev (June 2017)

No offense, but most local development environments are overkill. Vagrant is great if you want to match your site’s production environment, but it can often be fussy, and slow to spin up. Docker runs faster and is more lightweight, but it can be hard to get up and running if you’re not intimately familiar with how containers work.

Laravel’s Valet project is a simplified, local, PHP development environment for minimalists that uses lightweight packages—not virtual machines— to speed up development time.

In this session I will demonstrate how to install Valet, show off some of the features that make it so useful for WordPress developers, and share some power user tricks that I’ve learned while using it.

Jason Cosper

June 10, 2017
Tweet

More Decks by Jason Cosper

Other Decks in Technology

Transcript

  1. The Minimal Dev
    WordCamp OC 2017
    @boogah

    View Slide

  2. So...
    dev environments
    boogah.org/wcoc17

    View Slide

  3. Mamas, don't let your
    babies grow up to be
    cowboy coders
    boogah.org/wcoc17

    View Slide

  4. Dev environments
    • Vagrant
    • Docker
    • DesktopServer
    • Local
    • Chassis
    • MAMP
    • WAMP
    boogah.org/wcoc17

    View Slide

  5. boogah.org/wcoc17

    View Slide

  6. Valet
    boogah.org/wcoc17

    View Slide

  7. Why Valet?
    boogah.org/wcoc17

    View Slide

  8. Installing Valet
    boogah.org/wcoc17

    View Slide

  9. boogah.org/inst-valet

    View Slide

  10. Installing Valet (Homebrew)
    # Install Xcode Command Line Tools
    ! xcode-select --install
    # Install Homebrew
    ! /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    # Update Homebrew Package Index
    ! brew update
    # Confirm Homebrew is Installed Correctly
    ! brew doctor
    boogah.org/wcoc17

    View Slide

  11. Installing Valet (PHP 7)
    # Install PHP 7.0
    ! brew tap homebrew/php
    ! brew install php70
    # Install Xdebug (optional)
    ! brew install php70-xdebug
    # Confirm PHP is Installed Correctly
    ! php -v
    boogah.org/wcoc17

    View Slide

  12. Installing Valet (MySQL)
    # Install MySQL
    ! brew install mariadb
    # Launch MySQL at Login
    ! brew services start mariadb
    boogah.org/wcoc17

    View Slide

  13. Installing Valet (Composer)
    # Install Composer
    ! brew install composer
    # Confirm Composer is Installed Correctly
    ! composer -V
    boogah.org/wcoc17

    View Slide

  14. Installing Valet (Valet)
    # Install Valet (Part 1)
    ! composer global require laravel/valet
    # Install Valet (Part 2)
    ! valet install
    # Create a Directory for Valet Sites
    ! mkdir ~/sites/valet/
    ! cd ~/sites/valet/
    ! valet park
    boogah.org/wcoc17

    View Slide

  15. Installing WP-CLI
    boogah.org/wcoc17

    View Slide

  16. Install WP-CLI
    ! curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
    ! php wp-cli.phar --info
    ! chmod +x wp-cli.phar
    ! sudo mv wp-cli.phar /usr/local/bin/wp
    From wp-cli.org
    boogah.org/wcoc17

    View Slide

  17. Valet + WP-CLI
    boogah.org/wcoc17

    View Slide

  18. WP-CLI Valet commands
    ! wp package install aaemnnosttv/wp-cli-valet-command
    boogah.org/wcoc17

    View Slide

  19. Creating sites
    boogah.org/wcoc17

    View Slide

  20. Create a site
    ! wp valet new modok --admin_user=modok --admin_password=advanced-idea-mechanics
    Don't go anywhere, this should only take a second...
    Success: modok ready! https://modok.dev
    boogah.org/wcoc17

    View Slide

  21. boogah.org/wcoc17

    View Slide

  22. Destroy a site
    ! wp valet destroy modok --yes
    Success: modok was destroyed.
    boogah.org/wcoc17

    View Slide

  23. Preserving workflows
    boogah.org/wcoc17

    View Slide

  24. Supported workflows
    • Multisite
    • WordPlate
    • Skeleton
    • Bedrock
    boogah.org/wcoc17

    View Slide

  25. Showing off
    boogah.org/wcoc17

    View Slide

  26. Showing off
    ! cd ~/sites/valet/modok
    ! valet share
    ngrok by @inconshreveable (Ctrl+C to quit)
    Session Status online
    Version 2.2.4
    Region United States (us)
    Web Interface http://127.0.0.1:4040
    Forwarding http://bf40fa0e.ngrok.io -> modok.dev:443
    Forwarding https://bf40fa0e.ngrok.io -> modok.dev:443
    Connections ttl opn rt1 rt5 p50 p90
    0 0 0.00 0.00 0.00 0.00
    boogah.org/wcoc17

    View Slide

  27. Experimentation
    boogah.org/wcoc17

    View Slide

  28. Installing Elasticsearch
    ! brew install elasticsearch
    boogah.org/wcoc17

    View Slide

  29. boogah.org/wcoc17

    View Slide

  30. Maintaining Elasticsearch
    ! brew pin elasticsearch
    boogah.org/wcoc17

    View Slide

  31. boogah.org/wcoc17

    View Slide

  32. Questions?
    boogah.org/wcoc17

    View Slide