Laravel Essentials is a Laravel package that streamlines the setup of essential development tools and applies Laravel best practices to your application. It provides an interactive installation command that sets up code quality tools and configures your AppServiceProvider with production-ready optimizations.
Requires PHP 8.3+ and Laravel 11+
Install the package via Composer:
composer require patressz/laravel-essentials --devRun the installation command to set up your Laravel project with essential tools and configurations:
php artisan essentials:installThe installation command will:
-
Install Development Tools (interactive selection):
- Laravel Pint - Code style fixer
- PHPStan (Larastan) - Static analysis tool
- Rector - PHP automated refactoring tool
-
Configure AppServiceProvider with Laravel best practices:
- Model Strictness - Enforce strict model behavior in production
- Model Unguarded - Disable mass assignment protection globally
- Automatic Eager Loading - Prevent N+1 queries in development
- Date Configuration - Use Carbon Immutable by default
- Command Safety - Prohibit destructive commands in production
- HTTPS Enforcement - Force HTTPS scheme in production
- Asset Prefetching - Enable Vite asset prefetching
# Skip confirmation prompts and overwrite existing files
php artisan essentials:install --yesAfter installation, you can use these commands for code quality:
🧹 Code Style Fixing with Pint:
./vendor/bin/pint⚗️ Static Analysis with PHPStan:
./vendor/bin/phpstan🔧 Code Refactoring with Rector:
./vendor/bin/rectorThe package will create configuration files for the selected tools:
pint.json- Laravel Pint configurationphpstan.neon- PHPStan configuration with Laravel rulesrector.php- Rector configuration with Laravel-specific rules
- PHP 8.3 or higher
- Laravel 11.0 or higher
Laravel Essentials was created by Patrik Strišovský under the MIT license.