pyaesoneaung/laravel-starter-kit
最新稳定版本:v0.0.1
Composer 安装命令:
composer create-project pyaesoneaung/laravel-starter-kit
包简介
Laravel 12 starter kit with built-in strict typing, enhanced code quality tools, and safety features.
README 文档
README
Laravel 12 starter kit with built-in strict typing, enhanced code quality tools, and safety features.
Installation
laravel new --using pyaesoneaung/laravel-starter-kit --git
Setup Git Hooks
npm install
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.
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-05