Created
September 3, 2025 08:41
-
-
Save stevepop/7bbc4a8f105e67a788c5a264e5a018c2 to your computer and use it in GitHub Desktop.
Setup Laravel Application With Sail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Set up the project | |
| This section walks you through setting up the appointment booking application on your local machine. The GitHub repository for this project contains a Laravel application with most of the core functionality already implemented, leaving just a few key areas for you to complete as we progress through the tutorial. | |
| To get started: | |
| Clone the repository from GitHub and change into the new project directory | |
| ```bash | |
| git clone [email protected]:stevepop/clipperly-app.git | |
| cd clipperly-app | |
| ``` | |
| Create a new environment file by copying the example file provided: | |
| ```bash | |
| cp .env.example .env | |
| ``` | |
| Start the application with Laravel Sail | |
| Laravel Sail is a lightweight command line interface for managing Laravel's Docker-based development environment. Being a wrapper around Docker Compose, Sail mounts the local, project directory into the container, so that any changes made locally are reflected within the container. There are two ways to get started, depending on whether you have PHP and Composer installed locally. | |
| If you have PHP and Composer installed on your machine, you can simply run: | |
| ```bash | |
| composer install | |
| ``` | |
| This will install the required packages and then you can start Sail with: | |
| ```bash | |
| ./vendor/bin/sail up -d | |
| ``` | |
| If you do not have PHP/Composer installed locally and prefer a fully containerized development environment without installing PHP and Composer on your host machine, you can use Docker Compose directly to handle the initial setup: | |
| ```bash | |
| docker run --rm -v $(pwd):/app -w /app laravelsail/php82-composer:latest composer install --ignore-platform-reqs | |
| ``` | |
| After the packages are installed, start the application with: | |
| ```bash | |
| ./vendor/bin/sail up -d | |
| ``` | |
| Generate the application key | |
| Laravel requires an application key for encrypting user sessions and other sensitive data. This key ensures your application's security by providing a unique encryption signature. Generate it with the following command: | |
| ```bash | |
| ./vendor/bin/sail php artisan key:generate | |
| ``` | |
| Run the migrations and seeders | |
| We will now run the migrations to create our database tables as well as seeders to populate the database with test data. First, we make sure that the SQLite database file exists, then we run the migration with the `--seed` flag to populate the data. | |
| ```bash | |
| touch database/database.sqlite | |
| ./vendor/bin/sail artisan migrate --seed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment