skip to Main Content

I use the command

curl -s https://laravel.build/example-app | bash

And then I get Laravel 11.

How to install Laravel 10.x using Sail?

I tried command

composer create-project --prefer-dist laravel/laravel example-app "10.*"

but this project don’t use Sail.

2

Answers


  1. You can install manually using "composer create-project" and then install Sail later (as described here in the documentation)

    Install laravel/sail package
    composer require laravel/sail --dev

    Publish files
    php artisan sail:install

    Start Sail
    ./vendor/bin/sail up

    Login or Signup to reply.
  2. If you render/download the script used to install Laravel with Sail (like in a browser):

    https://laravel.build/example-app
    

    you will get something like this:

    docker info > /dev/null 2>&1
    
    # Ensure that Docker is running...
    if [ $? -ne 0 ]; then
        echo "Docker is not running."
    
        exit 1
    fi
    
    docker run --rm 
        --pull=always 
        -v "$(pwd)":/opt 
        -w /opt 
        laravelsail/php83-composer:latest 
        bash -c "laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "
    
    cd example-app
    
    # Allow build with no additional services..
    if [ "mysql redis meilisearch mailpit selenium" == "none" ]; then
        ./vendor/bin/sail build
    else
        ./vendor/bin/sail pull mysql redis meilisearch mailpit selenium
        ./vendor/bin/sail build
    fi
    
    CYAN='33[0;36m'
    LIGHT_CYAN='33[1;36m'
    BOLD='33[1m'
    NC='33[0m'
    
    echo ""
    
    if sudo -n true 2>/dev/null; then
        sudo chown -R $USER: .
        echo -e "${BOLD}Get started with:${NC} cd example-app && ./vendor/bin/sail up"
    else
        echo -e "${BOLD}Please provide your password so we can make some final adjustments to your application's permissions.${NC}"
        echo ""
        sudo chown -R $USER: .
        echo ""
        echo -e "${BOLD}Thank you! We hope you build something incredible. Dive in with:${NC} cd example-app && ./vendor/bin/sail up"
    fi
    

    the line where we have

    bash -c "laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "
    

    is the actual command to install Laravel.
    In this case you can replace it by the composer command to create a Laravel project:

    bash -c "composer create-project laravel/laravel:^10.0 example-app && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "
    

    of course you can also replace/add/remove the services you want in the "–with" parameter.

    Finally you only need save the new script content to a file and execute locally.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search