florianpalabost/lara-stubs
最新稳定版本:v0.1.0
Composer 安装命令:
composer require florianpalabost/lara-stubs
包简介
Opinionated Laravel stubs with strict types, final classes, and modern PHP conventions
README 文档
README
Opinionated Laravel stubs with strict types, final classes, and modern PHP conventions.
Features
- Strict Types: All PHP files include
declare(strict_types=1) - Final Classes: Uses
finalkeyword for better immutability and intentional inheritance - Modern Conventions: Follows current PHP and Laravel best practices
- Custom Stubs: Includes Action and Data stubs for common patterns
- Pest Integration: Test stubs use
it()syntax
Installation
Install via Composer:
composer require florianpalabost/lara-stubs --dev
Publish the stubs to your project:
php artisan vendor:publish --tag=lara-stubs
This will copy all stubs to your project's stubs/ directory, where Laravel will automatically use them.
Available Stubs
Custom Stubs
action.stub- Action pattern class with strict types and final modifierdata.stub- Spatie Laravel Data class
Enhanced Laravel Stubs
All standard Laravel stubs with improvements:
- Controllers (API, invokable, nested, singleton variants)
- Models, migrations, factories, seeders
- Jobs, listeners, events
- Policies, observers
- Requests, resources, rules
- Tests (Pest with
it()syntax) - And more...
Usage
After publishing, all php artisan make:* commands will use these stubs:
# Creates an Action with strict types and final modifier php artisan make:class CreateUserAction # Creates a Data class extending Spatie\LaravelData\Data php artisan make:class UserData # Creates a controller with enhanced stub php artisan make:controller UserController # Creates a Pest test using it() syntax php artisan make:test UserTest
Customization
After publishing, you can customize the stubs in your stubs/ directory. Your changes will be used instead of Laravel's defaults.
Requirements
- PHP 8.2 or higher
- Laravel 11.x or 12.x
License
MIT
统计信息
- 总下载量: 340
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-20