pyaesoneaung / laravel-starter-kit
Laravel 12 starter kit with built-in strict typing, enhanced code quality tools, and safety features.
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^8.2
- laravel/framework: ^12.12
- laravel/tinker: ^2.9
Requires (Dev)
- driftingly/rector-laravel: ^2.0
- fakerphp/faker: ^1.23
- larastan/larastan: ^3.0
- laravel/pail: ^1.1
- laravel/pint: ^1.13
- laravel/sail: ^1.26
- mockery/mockery: ^1.6
- nunomaduro/collision: ^8.1
- pestphp/pest: ^3.7
- pestphp/pest-plugin-laravel: ^3.0
- rector/rector: ^2.0
- tightenco/duster: ^3.1
README
Laravel Starter Kit
Laravel 12 starter kit with built-in strict typing, enhanced code quality tools, and safety features.
Features
✅ Strict Models
Model::shouldBeStrict();
This does three things:
- Prevents lazy loading
- It prevents silently discarding attributes.
- It prevents accessing missing attributes.
✋ Prevent Destructive Commands
Preventing the execution of destructive commands in production environments.
DB::prohibitDestructiveCommands(app()->isProduction());
⚡️ Automatic Relation Loading
Laravel can automatically eager load the relationships you access.
Model::automaticallyEagerLoadRelationships();
🪝 Git Commit Hook
Run duster lint for PHPStan, duster fix for refactor with Rector, and format with Laravel Pint before every commit.
Default Laravel Rector Rules
EloquentMagicMethodToQueryBuilderRector
use App\Models\User; -$user = User::find(1); +$user = User::query()->find(1);
EloquentWhereRelationTypeHintingParameterRector
-User::whereHas('posts', function ($query) { +User::whereHas('posts', function (Builder $query) { $query->where('is_published', true); }); -$query->whereHas('posts', function ($query) { +$query->whereHas('posts', function (Builder $query) { $query->where('is_published', true); });
EloquentWhereTypeHintClosureParameterRector
/** @var \Illuminate\Contracts\Database\Query\Builder $query */ -$query->where(function ($query) { +$query->where(function (Builder $query) { $query->where('id', 1); });
ModelCastsPropertyToCastsMethodRector
use Illuminate\Database\Eloquent\Model; class Person extends Model { - protected $casts = [ - 'age' => 'integer', - ]; + protected function casts(): array + { + return [ + 'age' => 'integer', + ]; + } }
ScopeNamedClassMethodToScopeAttributedClassMethodRector
class User extends Model { - public function scopeActive($query) + #[\Illuminate\Database\Eloquent\Attributes\Scope] + protected function active($query) { return $query->where('active', 1); } }
WhereToWhereLikeRector
-$query->where('name', 'like', 'Rector'); -$query->orWhere('name', 'like', 'Rector'); -$query->where('name', 'like binary', 'Rector'); +$query->whereLike('name', 'Rector'); +$query->orWhereLike('name', 'Rector'); +$query->whereLike('name', 'Rector', true);
😺 GitHub Actions
Automated workflows for continuous integration, running Laravel Pint and PHPStan on every push and pull request.
Installation
laravel new --using pyaesoneaung/laravel-starter-kit my-app