A Laravel application template focusing on 100% test & type coverage, and maximum static analysis.
It is built on top of Laravel Jetstream and includes the following tools pre-configured with sensible (strict) defaults:
- RectorPHP for automatic refactoring
- Larastan for static analysis
- Pint for code formatting
- PestPHP for testing
- Type Coverage Plugin for type-safe testing
- Test Coverage
- Prettier for Blade file formatting
- Configured per this article to automatically format Tailwind CSS classes inside Blade files
- Using prettier-plugin-blade and prettier-plugin-tailwindcss
cp .env.example .env
Update the .env
file with your APP_NAME
, APP_URL
, local database credentials.
Feel free to change any other variables to fit your local environment needs.
composer install
npm install && npm run build
touch database/database.sqlite
php artisan key:generate
php artisan migrate
vendor/bin/pest --update-snapshots
composer refactor # read note below
Warning
Rector may complain when you composer install
or composer require
because these commands can overwrite files in your /bootstrap
directory.
Simply run composer refactor
to make Rector happy 👼
At this point, you can start the development server with composer dev
.
You can run composer test
, which should yield a passing test suite, with 100% test and type coverage.
Tools are exposed as Composer scripts.
composer test # @test:refactor && @test:lint
# && @test:types && @test:static-analysis && @test:unit
# `composer test` will run the tools in the following order:
composer test:refactor # rector --dry-run
composer test:lint # pint --test && prettier --check resources/
composer test:type # pest --type-coverage --colors=always --memory-limit=512M --min=100
composer test:static-analysis # phpstan analyse --ansi --memory-limit=512M
composer test:unit # pest --colors=always --coverage --parallel --min=100
# Tools are also individually exposed as separate scripts:
composer lint # pint && prettier --write resources/
composer lint:php <file> # pint <file>
composer lint:blade <file> # prettier --write <file>
composer refactor # rector
The Laravel framework is open-sourced software licensed under the MIT license.