# How to start a new Laravel project with Laravel Sail without local installation of PHP

For some reason, since Laravel 12, official Laravel docs no longer provide guidance on how to set up Laravel project locally with Laravel Sail, without having PHP available on your machine - i.e. going right away for Docker, and skipping local installation of PHP altogether. It may seem like you have to use Laravel Installer, or third-party services like Laravel Herd, but it's not the case. Simple Laravel Sail setup still works just fine.

The only thing you need to do before is to make sure you have docker installed on your machine, and [added `sail` alias, as described in Laravel Sail docs](https://laravel.com/docs/11.x/sail#configuring-a-shell-alias). This approach works both in WSL2 on Windows 11 and MacOS.

To set up the project, run the following command in your terminal:

```shell
APP_NAME=laravel-example

docker run \
    --rm \
    --interactive \
    --tty \
    --volume $(pwd):/app \
    composer:latest \
        bash -c " \
            composer create-project \"laravel/laravel\" $APP_NAME \
            && \
            cd $APP_NAME \
            && \
            composer require laravel/sail --dev \
            && \
            php artisan sail:install
        "
```

There's no magic here. We first define the APP\_NAME. Then, set up Laravel project in a directory called APP\_NAME relative to the current directory using `composer create-project` (which was [the approach mentioned in Laravel docs until Laravel 10](https://laravel.com/docs/10.x/installation#creating-a-laravel-project)). We then install Laravel Sail, and then run `php artisan sail:install` command. In the process, we use [the official composer:latest docker image](https://hub.docker.com/_/composer)r image, which has PHP and composer installed, allowing us to set up the Laravel App.

And you’re done. You can run `sail up -d`, and then `sail artisan --help` to verify that things work as expected.

Sources:

*   [https://github.com/laravel/sail/issues/839#issuecomment-3632410241](https://github.com/laravel/sail/issues/839#issuecomment-3632410241)
    
*   [https://chuniversiteit.nl/programming/create-new-laravel-project-using-docker#use-the-composer-image](https://chuniversiteit.nl/programming/create-new-laravel-project-using-docker#use-the-composer-image)
