- Click the
Use this template
button at the top of this project's GitHub page, it looks like this:
- After using the template, clone the repo
- Laravel Template assumes you have
composer
installed globally:
# Install Laravel into a `src` directory
composer create-project laravel/laravel src
Once Laravel is installed, replace text as needed throughout the project:
- Replace all instances of
laravel-template
with the name of your project (found in docker-compose files) - Replace all values in
src/.env
to reflect the values you need - Update name in
LICENSE
- Uncomment and configure the
.github/workflows/build.yml
file - Update the
CHANGELOG
- Delete this
README
and create a new one for your project
- Change the
session
driver from file based to database - Change the logging from
stack
todaily
- (Optional) Change the
cache
driver from file based to Redis
In the composer.json
file, add the following:
"bin-dir": "bin"
to theconfig
section- Install PHP CodeSniffer:
composer require --dev squizlabs/php_codesniffer
- Install larastan:
composer require --dev larastan/larastan
- Install Justintime50 PHP styles via
npm install --save-dev justintime50-styles
- Correct prod and dev dependencies as production builds won't contain dev deps
- Add the folllowing to the
scripts
section of thecomposer.json
file:
"clean": "rm -rf bin clover.html node_modules vendor *.cache .*.cache bootstrap/cache/*.php",
"coverage": "XDEBUG_MODE=coverage ./bin/phpunit --coverage-html clover.html --coverage-clover clover.xml",
"clean-db": "docker exec -t laravel-template-laravel-template-1 php artisan db:wipe",
"fix": "./bin/phpcbf --standard=./node_modules/justintime50-styles/src/php/phpcs.xml .",
"lint": "./bin/phpcs --standard=./node_modules/justintime50-styles/src/php/phpcs.xml .",
"migrate-fresh": "docker exec -t laravel-template-laravel-template-1 php artisan migrate:fresh --no-interaction --force",
"migrate-seed": "docker exec -t laravel-template-laravel-template-1 php artisan migrate:fresh --seed --no-interaction --force",
"migrate": "docker exec -t laravel-template-laravel-template-1 php artisan migrate --no-interaction --force",
"phpstan": "./bin/phpstan analyse --memory-limit=2G",
"rollback": "docker exec -t laravel-template-laravel-template-1 php artisan migrate:rollback --no-interaction --force",
"seed": "docker exec -t laravel-template-laravel-template-1 php artisan db:seed --no-interaction --force",
"test": "./bin/phpunit"
- Add the following to the
scripts
section of thepackage.json
file:
"lint": "npx stylelint resources/sass/*.scss --config node_modules/justintime50-styles/src/css/.stylelintrc.json --custom-syntax postcss-scss",
"fix": "npx stylelint resources/sass/*.scss --config node_modules/justintime50-styles/src/css/.stylelintrc.json --custom-syntax postcss-scss --fix"
- Create a
phpstan.neon
file with the following content:
includes:
- vendor/larastan/larastan/extension.neon
parameters:
paths:
- app/
- tests/
level: 5
# Copy the env files, and edit as needed
mv src/.env.example src/.env-example
cp src/.env-example src/.env && cp .env-example .env
# Move the justfile location
mv justfile src/justfile
# Run the setup script which will bootstrap all the requirements, spin up the service, and migrate the database
just setup
- Setup Traefik to manage routing and load balancing
- Setup DNSMasq so you don't have to manage your
/etc/hosts
file while using Traefik for local development
# Deploy the project locally
just run
# Deploy the project in production
just prod
The following commands may need to be manually added before they're ready to use.
# Get a comprehensive list of development tools
just --list