A modern, fully-featured Laravel package template that scaffolds a production-ready package with interactive configuration, integrated tooling, CI/CD pipelines, and Laravel Boost support.
- Interactive Installer: Guided setup with spinner-based progress display and CTRL+U go-back support
- Configurable Tooling: Choose your PHPStan level (0-10) and Laravel Pint preset (laravel, psr12, per, symfony)
- Community Files: Optional CONTRIBUTING.md, SECURITY.md, and GitHub issue templates
- MCP Configuration: Automatic setup for VS Code, Cursor, Gemini, and Junie with Laravel Boost MCP server
- Resource Management: Selective inclusion of migrations, views, translations, routes, and publishable assets
- CI/CD Pipeline: GitHub Actions workflow with linting, static analysis, and tests
- Laravel Boost Integration: Full support for Laravel Boost with testbench MCP configuration
- Workbench Support: Local development environment for testing your package
Two ways to start:
-
Clone this template repo (will drop the template remote automatically):
git clone git@github.com:Convertain/laravel-package-template.git your-package-name cd your-package-name php install.phpThe installer will remove the template
originremote if it points toConvertain/laravel-package-template, so you can add your own remote afterwards. -
Use GitHub’s “Use this template → Create a new repository” (your remotes are already correct):
php install.php
During installation you will be guided through:
- Package name and vendor details
- Author name and email
- GitHub repository URL
- License selection (MIT, Proprietary, Apache 2.0, or BSD-3-Clause)
- Feature selection (config, routes, views, translations, migrations)
- Community files (CONTRIBUTING.md, SECURITY.md, issue templates)
- PHPStan validation level (0-10)
- Laravel Pint preset (laravel, psr12, per, symfony, empty)
- Laravel Boost installation (optional, default yes)
- Composer dependency installation and workbench setup
- Code quality checks (lint and static analysis)
Start developing:
composer serve # Start the workbench appWhen you create a repo via GitHub’s Use this template button, GitHub initializes the default branch as main, but the branch policy in .github/workflows/enforce-branch-policy.yml runs on master and *.x release branches. After running install.php, align your branches with the policy:
# Rename local main to master and push it as the new default branch
git branch -m main master
git push origin -u master
# Create the first release branch from master (example: 1.x)
git checkout -b 1.x master
git push origin -u 1.x
# Switch the default branch to the release branch (requires GitHub CLI auth)
gh repo edit --default-branch 1.x
# Alternatively via GitHub UI: Repo → Settings → Default Branch → Change to 1.x, then save
# Delete main on the remote (after default branch is changed)
git push origin --delete main
# Create a feature branch from master (open PRs from here into master)
git checkout master
git pull
git checkout -b feature/your-featurecomposer test # Run the test suite with PHPUnit
composer analyse # Run PHPStan static analysis (configured level)
composer lint # Check and fix code style with Laravel Pint
composer lint:fix # Auto-fix code style issuescomposer serve # Start the Workbench development server
composer workbench:install # Reinstall the workbenchAfter installation, your package will be:
- Named as
vendor_slug/package_slug - Using namespace
Vendor\Package - Auto-discovered by Laravel via
Vendor\Package\PackageServiceProvider
Based on the features you selected during install.php, your package will automatically register:
| Feature | Auto-Registration | Description |
|---|---|---|
| Configuration | mergeConfigFrom() |
Config values available via config('your-package.key') |
| Web Routes | loadRoutesFrom() |
Routes immediately available in the application |
| API Routes | loadRoutesFrom() |
API routes immediately available |
| Views | loadViewsFrom() |
Views accessible via view('your-package::view-name') |
| Translations | loadTranslationsFrom() |
Translations via __('your-package::messages.key') |
| Migrations | loadMigrationsFrom() |
Migrations run automatically with php artisan migrate |
Publishing is optional and only needed if users want to customize the package assets. The following publish tags are available based on your selected features:
# Configuration file
php artisan vendor:publish --tag=your-package-config
# Blade views (for customization)
php artisan vendor:publish --tag=your-package-views
# Translation files
php artisan vendor:publish --tag=your-package-lang
# Migration files (if users need to modify them)
php artisan vendor:publish --tag=your-package-migrationsNote: Replace
your-packagewith your actual package slug (e.g.,my-awesome-package-config).
| Technology | Version | Purpose | Documentation |
|---|---|---|---|
| Laravel | 12.x | Framework foundation | Docs |
| PHP | 8.2 - 8.5 | Language requirement | Docs |
| Orchestra Testbench | ^10 | Laravel package testing | Docs |
| PHPUnit | ^11 | Unit testing framework | Docs |
| PHPStan | ^2 (Level 0-10) | Static code analysis | Docs |
| Larastan | ^3 | Laravel-aware PHPStan | Docs |
| Laravel Pint | ^1.14 | Code style formatter | Docs |
| Laravel Boost | ^1.0 | Development enhancement | Docs |
| phpstan/extension-installer | ^1.4 | PHPStan extension auto-discovery | GitHub |
The installer automatically updates MCP configurations for popular code editors:
- VS Code:
.vscode/mcp.json - Cursor:
.cursor/mcp.json - Gemini:
.gemini/settings.json - Junie:
.junie/mcp/mcp.json - Generic:
.mcp.json
All configurations are set to use vendor/bin/testbench boost:mcp for Laravel Boost integration. If you're using a different editor or the configuration isn't auto-updated, manually change:
{
"laravel-boost": {
"command": "vendor/bin/testbench",
"args": ["boost:mcp"]
}
}├── .github/
│ ├── ISSUE_TEMPLATE/ # Bug report & feature request templates
│ └── workflows/ # CI/CD GitHub Actions
├── config/ # Package configuration files
├── data/ # Template resources (removed after install)
├── src/
│ ├── Contracts/ # Package interfaces
│ ├── Services/ # Core service classes
│ ├── Steps/ # Installation steps
│ ├── Traits/ # Reusable traits
│ └── PackageServiceProvider.php
├── tests/
│ ├── Feature/ # Feature tests
│ ├── Unit/ # Unit tests
│ └── TestCase.php
├── workbench/ # Development/testing app (created by installer)
├── composer.json
├── CONTRIBUTING.md # Contribution guidelines (optional)
├── SECURITY.md # Security policy (optional)
├── phpstan.neon.dist
├── phpunit.xml.dist
├── pint.json
└── README.md
During installation, you can choose which GitHub Actions workflows to include in your package. By default, all three are enabled:
-
ci.yml- Validates code style with Laravel Pint, performs static analysis with PHPStan, and runs the test suite with PHPUnit- Runs on:
masterbranch and*.xrelease branches - Can be disabled during installation if you have a different CI/CD setup
- Runs on:
-
enforce-branch-policy.yml- Enforces a branching strategy for organized development and releases- Runs on:
masterbranch and*.xrelease branches (does NOT run onmain) - Can be disabled if you prefer a different branching workflow
- Runs on:
-
validate-release.yml- Validates release tags follow semantic versioning and match the release branch- Runs on: GitHub release published/edited events
- Can be disabled if you manage releases differently
The template includes optional workflows that enforce this branching model for your generated package:
Feature branches
↓
master (development/main development branch)
↓
1.x, 2.x, etc. (release branches - only for critical hotfixes)
↓
GitHub Releases (v1.0.0, v1.0.1, v2.0.0, etc.)
Branch Rules:
- Feature branches →
master(all new features and changes) master→1.x,2.x, etc. (for releases only)1.x,2.x, etc. → Only for critical hotfixes/cherry-picks
Release Validation:
When creating a GitHub release, the workflow validates:
- Semantic Versioning: Tag must match format
X.Y.ZorX.Y.Z-alpha(e.g.,1.0.0,2.1.3-beta) - Branch Matching: Release from
1.xmust have tag starting with1.(e.g.,1.0.0,1.2.5) - Correct Branch: Release from
2.xmust have tag starting with2.(e.g.,2.0.0,2.1.0)
Examples:
- ✅ Release
1.0.0from1.xbranch → Valid - ✅ Release
1.2.3-alphafrom1.xbranch → Valid - ❌ Release
2.0.0from1.xbranch → Invalid (major version mismatch) - ❌ Release
1.0.0-invalidfrom1.xbranch → Invalid (non-semantic tag)
During Installation:
When you run install.php, you'll be asked which GitHub workflows to include. All three workflows are selected by default, but you can deselect any you don't need.
After Installation: If you want to disable a workflow after installation, simply delete the corresponding file:
- Remove
.github/workflows/ci.ymlto disable CI/CD pipeline - Remove
.github/workflows/enforce-branch-policy.ymlto disable branch policy enforcement - Remove
.github/workflows/validate-release.ymlto disable release validation
Or you can manually edit the workflow files to customize their behavior (e.g., change the branches they run on, add additional checks, etc.).
This template defaults to a Proprietary license. You can choose a different license during installation:
- MIT
- Proprietary
- Apache License 2.0
- BSD 3-Clause License
See LICENSE.md for the selected license details.
For issues or questions about the template, please open an issue on this repository.
If you use this template for your Laravel package, we'd love it if you:
⭐ Star this repository — It helps others discover it!
📝 Credit the template — Add a note to your README:
Built using [Laravel Package Template](https://github.com/Convertain/laravel-package-template)💖 Consider sponsoring — If this template saved you time, consider sponsoring the maintainers to support continued development.
Made with ❤️ by Convertain