skip to Main Content

I want to install Laravel 9 with sail, but when I execute: curl -s "https://laravel.build/example-app" | sh , the command installs Laravel 11.

Is there a command that allows me to specify which version I want to install?

A command equivalent to this:
composer create-project laravel/laravel:^9.0 example-app

I tried this: curl -s "https://laravel.build/devjobs" | sh , but this command installs Laravel 11, I want to install Laravel 9.

2

Answers


  1. Never use older versions of Laravel.
    Laravel9 is already EOL.
    https://laravel.com/docs/11.x/releases

    Always use the latest version when creating a new project.

    Login or Signup to reply.
  2. 1) composer create-project (depends on having php and composer installed)

    You can use the --ignore-platform-reqs option to prevent composer from nagging you about dependencies you might be missing (since you’re going to develop on sail, your host machine shouldn’t need anything aside from docker)

    Create project

    composer create-project laravel/laravel:^9.0 devjobs --ignore-platform-reqs
    

    Require sail

    cd devjobs
    
    composer require laravel/sail --dev --ignore-platform-requs
    

    Install sail

    php artisan sail:install
    
    ./vendor/bin/sail up -d
    

    If you don’t have composer installed, first get Composer

    2) git clone and docker run

    Clone the laravel/laravel repo

    git clone https://github.com/laravel/laravel.git devjobs
    

    Remove repo files

    cd devjobs
    
    rm -rf .git/
    rm -rf .github/
    rm .styleci.yml
    

    Install composer dependencies through docker

    docker run --rm 
        -u "$(id -u):$(id -g)" 
        -v "$(pwd):/var/www/html" 
        -w /var/www/html 
        laravelsail/php82-composer:latest 
        composer install --ignore-platform-reqs
    

    Install dependencies (including sail) through docker

    docker run --rm 
        -u "$(id -u):$(id -g)" 
        -v "$(pwd):/var/www/html" 
        -w /var/www/html 
        laravelsail/php82-composer:latest 
        composer require laravel/sail --ignore-platform-reqs
    

    Publish sail’s docker-compose file

    docker run --rm 
        -u "$(id -u):$(id -g)" 
        -v "$(pwd):/var/www/html" 
        -w /var/www/html 
        laravelsail/php82-composer:latest 
        php artisan sail:install --no-interaction
    
    ./vendor/bin/sail up -d
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search