Mac Minimalist development Environment Laravel Valet Practice

Source: Internet
Author: User
Laravel Valet is a MacThe following minimalist development environment, not only can be developed locally, you can also share access to the public network, when your computer will be in the background after the boot Caddy, valet through DnsMasq all the. Dev domain points to your locally installed site, such as the Site Directory blog, access to BL through the browser Og.dev will automatically access the blog. Share to the public network in fact, mainly rely on Ngrok to achieve.

Let's install it first.

    • Update Homebrew
Brew Update  
    • Ensure that brew services is available
Brew Services List  
    • Install php70 if not installed
Brew Install PHP70  
    • Ensure that ~/.composer/vendor/bin has been added to the system path directory
    • Installing Valet
Composer Global require Laravel/valet  
    • Installing valet and DnsMasq
Valet Install  

If the following error occurs in the previous step:

[Reflectionexception]  Class Fxp\composer\assetplugin\repository\npmrepository does not exist

This is due to the Composer\repository\composerrepository::whatprovides API update, you have installed the fxp/composer-asset-plugin globally, so you need to update it:

Composer Global require Fxp/composer-asset-plugin--no-plugins  

If DnsMasq installation fails, install it manually

Brew Install DNSMASQ  
    • Ping the *.dev, if the ping has a description, OK.
⇒  Ping *.devping *.dev (127.0.0.1): Data bytes bytes from 127.0.0.1:icmp_seq=0 ttl=64 time=0.040  Ms  64 Bytes from 127.0.0.1:icmp_seq=1 ttl=64 time=0.065 ms to  bytes from 127.0.0.1:icmp_seq=2 ttl=64 time=0.064 Ms  64 Bytes from 127.0.0.1:icmp_seq=3 ttl=64 time=0.062 ms  

Below to launch a valet site

The drivers currently supported until 1.1.7 are as follows:

    • Laravel
    • Lumen
    • Symfony
    • Zend
    • CakePHP 3
    • Wordpress
    • Bedrock
    • Craft
    • Statamic
    • Jigsaw
    • Wordpress
    • Joomla
    • Contal
    • Sculpin
    • Static HTML

Of course, you can also drive yourself, Custom valet Drivers

    • Create a folder
mkdir ~/webroot/valetsite && CD ~/webroot/valetsite  
    • Run the Park command and use the above directory as the search site path
Valet Park  
    • Create a laravel-driven site
Laravel New Blog  
    • Browser access Http://blog.dev is OK.

About the link command

The link command can also be used to start the Laravel site. The park command will treat all folders in this directory as separate sites, and you can use the link command when you only need to start a site.

CD ~/webroot/valetsite/blog  Valet Link Test-blog  

Execute the above command to access the project site through Http://test-blog.dev, and there are two useful commands:

Valet Links  Valet unlink  

You'll know what you're doing with a look.

Let the site support TLS

Allowing the site to support TLS is also simple, and needs to be executed from:

Valet Secure Blog  

This will allow you to access it with Https://blog.dev and cancel the words:

Valet Unsecure Blog  

Share site

This demand is actually very practical, such as the development of their own things need to let others through the external network access, just need a simple command to

Valet Share  

This will generate an extranet URL via Ngrok, and to stop sharing, you can press Control + C to cancel the process.

Ngrok by @inconshreveable                                                                                                                                                 (Ctrl + C to quit) tunnel Status                 online  Version                       2.0.25/2.1.1                        Region States (US)  Web Interface                 http://127.0.0.1:4040  Forwarding                    Http://fda651a8.ngrok.io blog.dev:80  Forwarding                    https://fda651a8.ngrok.io-blog.dev:80connections                   ttl     opn     Rt1     rt5     p50     P90                                0       0       0.00    0.00    0.00    0.00

View the site log

If you want to view the logs for all sites, the new logs will be automatically displayed in the terminal only to perform valet logs

There's actually a hidden console: access to Http://localhost:4040/inspect/http

and some valet commands.

Command Description

Valet Forget

Execute the command in the directory "parked" to remove it from the parded directory list.

Valet paths

View all "parked" paths

Valet restart

Restarting the valet program

Valet Start

Start the Valet program

Valet Stop

Stop Valet Program

Valet Uninstall

Uninstalling the Valet program

Reprint Please specify: Reproduced from Ryan is a rookie | LNMP Technology Stack Notes

If you think this article is very useful to you, why not give it a reward?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.