marekmiklusek / laravel-package-skeleton
Laravel package skeleton with Pest, PHPStan, Rector and Pint wired up, and 100% coverage enforced in CI.
Package info
github.com/marekmiklusek/laravel-package-skeleton
pkg:composer/marekmiklusek/laravel-package-skeleton
Requires
- php: ^8.4
- illuminate/support: ^13.0
Requires (Dev)
- larastan/larastan: ^3.10
- laravel/pint: ^1.30.5
- orchestra/testbench: ^11.2
- pestphp/pest: ^5.1.2
- pestphp/pest-plugin-laravel: ^5.0.1
- pestphp/pest-plugin-phpstan: ^5.2
- pestphp/pest-plugin-type-coverage: ^5.0.2
- rector/rector: ^2.6.3
README
๐๏ธ Modern Laravel package skeleton with development tools pre-configured.
A starting point for building Laravel packages, with testing, static analysis, refactoring and code style already wired up and enforced in CI.
Features
- ๐งช Pest 5 with Testbench, arch tests and parallel execution
- ๐ฆ
illuminate/supportonly, so the skeleton does not force a framework version on consumers - ๐ 100% code coverage and 100% type coverage enforced
- ๐ PHPStan (Larastan) at level
maxoversrcandtests - ๐ง Rector automated refactoring and PHP version upgrades
- ๐จ Laravel Pint code formatting
- ๐ GitHub Actions tests across PHP 8.4 / 8.5 and lowest / highest dependencies
- ๐ค Dependabot for Composer and GitHub Actions updates
Requirements
- PHP 8.4+
- Laravel 13+
Installation
Create a new Laravel package from this skeleton:
composer create-project marekmiklusek/laravel-package-skeleton your-package-name
This creates a your-package-name directory with all skeleton files. Then rename
the namespace, the service provider and the package name in composer.json to
match your package.
Usage
| Command | What it does |
|---|---|
composer test |
Run every quality gate the CI pipeline runs |
composer test:unit |
Run the test suite with exactly 100% code coverage |
composer test:type-coverage |
Require 100% type coverage |
composer test:types |
Run Larastan static analysis |
composer test:lint |
Check code style and pending refactorings without writing files |
composer lint |
Apply Rector refactorings and fix code style |
Run composer test before pushing. It mirrors CI exactly.
What's Included
| Path | Purpose |
|---|---|
src/ |
Your package source code |
src/PackageSkeletonServiceProvider.php |
The package service provider |
tests/TestCase.php |
Testbench base test case registering the provider |
tests/Pest.php |
Pest configuration binding Testbench to Feature only |
tests/ArchTest.php |
Architecture rules (strict types, no debug calls) |
tests/Feature/ |
Feature tests booting a real Laravel application via Testbench |
tests/Unit/ |
Unit tests running without a framework instance |
phpstan.neon |
Static analysis configuration |
rector.php |
Refactoring rules |
pint.json |
Code style configuration |
phpunit.xml |
Test runner and coverage source configuration |
.github/workflows/tests.yml |
GitHub Actions test pipeline |
.github/dependabot.yml |
Dependency update automation |
Dependencies
The package itself only requires illuminate/support, not the full framework.
Add further illuminate/* components to require as your package needs them,
and keep orchestra/testbench in require-dev for testing against a real
Laravel application.
Changelog
See CHANGELOG.md.
License
The MIT License (MIT). See LICENSE.md.