jasonmccallister / laravel-preset
Presets for Laravel applications with Docker, PHPCS, PHPUnit, and etc.
Installs: 120
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/jasonmccallister/laravel-preset
Requires
- laravel/framework: ^5.8
- sixlive/dotenv-editor: ^1.2
This package is auto-updated.
Last update: 2025-10-16 03:44:06 UTC
README
This preset will install and prompt you to install Laravel official packages like Horizon and Telescope. This also includes a Makefile for helpful commands for local development and continous integration.
The overall goal is to make it as easy as possible to ship a project with Laravel using Docker, CI/CD, and PHPUnit testing.
Docker
Taking years of experience shipping PHP applications (both Craft CMS and Laravel) with Docker, this is a combination of lessons learned in one package.
Installation
You can install the package via composer:
composer require --dev jasonmccallister/laravel-preset
Usage
php artisan preset jasonmccallister
Follow the prompts on which database to use and what packages to include in the project.
Now all that is left is to run the following command:
make up
Docker
Running the preset command (php artisan preset jasonmccallister) will prompt you on the type of database you are going to use on the project. This will setup the Dockerfile and docker-compose file with the correct database dependencies.
There is a .dockerignore that will exclude the vendor and node_modules from the Docker Build Context. This is included to improve the build times for Docker.
Dockerfile
The goal is to use the same Dockerfile for local development, CI/CD, and deploying a production image. By default only "production" OS packages are installed.
PHP Extensions like xdebug can be installed but are not enabled by default, there is a
Makefilecommand for that!
docker-compose.yaml
To make development with Docker easier locally, we use the docker-compose.yaml to scaffold the creation of the database, queue, and redis instance. Docker Compose makes it really easy to spin all of your services up with one command.
There are a few things of note with this file:
- The volumes are tagged with
:cacheto improve Docker's performance with macOS specifically but has no impact on other operating systems - There are lines commented out if you are not using Laravel Passport
- No image is specified for the app and queue containers, this will default to the root folders name. Instead the file will look at the Dockerfile and build the image if it cannot find it locally
Packages
The preset will prompt you to install some recommended first-party packages.
Note: if you select to install Horizon, the preset will also prompt you to use the horizon command instead of
queue:work. Again this is optional but recommended when using Horizon.
Makefile
The preset will also install a Makefile with a lot of helpful commands. Here is a list of available commands:
make buildwill build an imagemake composerwill install composer dependencies inside of a throw away docker container and copy to your local machinemake downwill stop, or shutdown, the projects servicesmake horizonwill runphp artisan horizon:installmake logswill show all of your serivces logs with the--followflagmake migratewill runphp artisan migrateinside of the docker containermake migrate:freshwill runpap artisan migrateinside of the docker containermake phpcswill apply.php_csfixes on theappdirectorymake phpunitruns phpunit inside of the container, useful for CI/CD environmentsmake reportsruns phpunit with HTML code coverage inside the containermake scalewill scale your queue container up to 15 containers. Useful for testing concurrency of background jobs and queues locallymake seedrunsdb:seedinside of your containermake sshwill "ssh" you into the app container with a bash shellmake ssh-queuethe same as thesshcommand but will give you a bash shell in the queue containermake tagwill tag your docker imagemake tinkerrunsphp artisan tinkerinside the app containermake telescopewill runphp artisan telescope:installmake testdoxruns phpunit with the--testdoxflag for prettier outputmake upis used to start all of your servicesmake xdebugwill install the xdebug PHP Extension inside of your app container
Security
If you discover any security related issues, please email themccallister@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.