abe / laravel-prism
New Laravel project setup.
Fund package maintenance!
abe
Requires
- php: ^8.3|^8.4
- godruoyi/php-snowflake: ^3.1
- illuminate/contracts: ^10.0||^11.0||^12.0
- jiannei/laravel-response: ^6.0
- laravel/prompts: ^0.1.18|^0.2.0|^0.3.0
- spatie/laravel-package-tools: ^1.19
Requires (Dev)
- larastan/larastan: ^2.6.5||^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8|^8.0
- orchestra/testbench: ^8.0||^9.0||^10.0
- pestphp/pest: ^2.0||^3.0
- pestphp/pest-plugin-arch: ^2.0||^3.0
- pestphp/pest-plugin-laravel: ^2.0||^3.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
A Laravel package that sets up new projects with opinionated defaults and useful traits.
Quick Start
- Install the package:
composer require abe/laravel-prism
- Run the installation command:
php artisan prism:install
This will guide you through configuring Laravel behaviors and optionally installing development tools like Telescope.
What's Included
Laravel Configuration
- Immutable Dates: Use immutable date objects for better consistency
- Model Strict Mode: Prevent lazy loading and mass assignment issues
- Unified Responses: Consistent API response format
- Prohibit Destructive Commands: Prevent accidental data loss in production
Useful Traits
HasSnowflake
Automatically generates snowflake IDs for your models:
use Abe\Prism\Traits\HasSnowflake; class Product extends Model { use HasSnowflake; // Snowflake ID will be automatically generated }
HasResponse
Provides consistent response methods for controllers:
use Abe\Prism\Traits\HasResponse; class ProductController extends Controller { use HasResponse; public function show($id) { $product = Product::find($id); return $product ? $this->success($product) : $this->fail('Product not found', 404); } }
Optional Development Tools
- Laravel Telescope: Debug and monitor your application (optional)
Documentation
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.