When starting a new Laravel project, I always found myself repeating the same steps: installing essential packages, publishing configs and migrations, setting up a proper project structure, writing helpers, configuring QA tools, and adding CI/CD workflows.
I also have the Project Template, pre-configured with all common setup.
But then, I'm thinking back, if I want to use the same or similar setup for new Laravel project, that would be nice, without maintaining Project Template and It will be useful for other people to use same approach as mine.
Thatโs why I created Laravel Starter โ a template repository with a script that handles all the heavy lifting for you.
The script will automate the setup to follow configurations based on my Project Template and some practices I use in my articles.
โจ Why Laravel Starter?
Instead of spending the first hour of a new project setting things up, you can bootstrap your Laravel app in a few minutes:
- ๐ฆ Installs essential packages (Permissions, Media Library, Auditing, Debugging, etc.)
- โ๏ธ Configures QA tools like PHPStan, Rector, Pest, and Pint
- ๐ Sets up a clean project structure
- โ Generates an architecture test suite to enforce coding standards
- ๐ Creates documentation templates (Changelog, Contributing, Security, Support, License)
- โก Adds GitHub Actions workflows for linting, testing, static analysis, and changelog updates
- ๐ง Runs migrations & artisan tasks automatically
๐ Project Structure Highlights
After running the setup script, youโll notice a few key improvements:
support/helpers.php
A central place for reusable helper functions, auto-loaded via Composer.
Organised Routes
Routes are split into:
routes/web/
routes/api/
routes/console/
Each main file (web.php
, api.php
, console.php
) auto-loads all files in its directory.
tinker/
Directory
A scratchpad for experiments, ignored by Git.
docs/README.md
Kickstarts your documentation with a default TOC.
Architecture Test
Pest-powered tests to enforce conventions (e.g., no dd()
or raw DB queries in App
).
๐ฆ Included Packages
Core
- spatie/laravel-permission โ Role & permission management
- spatie/laravel-medialibrary โ Media handling
- cleaniquecoders/laravel-media-secure โ Secure media storage
- owen-it/laravel-auditing โ Audit logs
- cleaniquecoders/traitify โ Handy Laravel traits
Developer Tools
๐ ๏ธ Usage
This script is meant for new Laravel projects only.
In your fresh Laravel project root, run:
curl -s https://raw.githubusercontent.com/cleaniquecoders/laravel-starter/main/setup.php | php
The script will:
- Install all required packages.
- Update
composer.json
with QA scripts and helper autoloading. - Create
support/
,routes/
,tinker/
, anddocs/
directories. - Publish vendor configs and migrations.
- Generate documentation templates and CI workflows.
- Run artisan tasks like migrations and storage linking.
๐งช Example: Architecture Test
Out of the box, youโll have tests/Feature/ArchitectureTest.php
with useful rules, like:
arch()
->expect(['dd', 'dump', 'ray'])
->not
->toBeUsedIn([
'app',
'config',
'database',
'routes',
'support',
]);
arch()
->expect('App\Http\Controllers')
->toHaveSuffix('Controller');
This ensures your project stays clean and consistent as it grows.
๐ Next Steps
- Update
.env
with your projectโs database and mail settings. - Commit and push to GitHub.
- Watch the included GitHub Actions workflows automatically lint, analyse, and test your code.
๐ฑ Conclusion
With Laravel Starter, you donโt need to waste time reinventing your base setup. Youโll have a ready-to-go Laravel project with industry best practices baked in โ so you can focus on what matters: building features.
I'm planning to add more related setup in the future. For start, this is good enough.
Top comments (0)