cleaniquecoders / laravel-contract
Common Contracts for Laravel
Installs: 1 660
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 3
Requires
- php: ^8.1 | ^8.2 | ^8.3
- illuminate/contracts: ^9.0 | ^10.0 | ^11.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.0
- orchestra/testbench: ^8.0 | ^9.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5 | ^10.0
This package is auto-updated.
Last update: 2024-11-25 12:14:24 UTC
README
A simple package to handle common contracts.
Installation
You can install the package via composer:
composer require cleaniquecoders/laravel-contract
Usage
php artisan make:contract Action
The command will generate the contract:
<?php namespace App\Contracts; interface Action { }
Available contracts in this package:
CleaniqueCoders/LaravelContract/Contracts/Api
This allow standard form of getting the API response structure. However, you don't need to use this if using Pagination.
return response()->json( $api->getApiResponse(request()), $api->getCode() );
CleaniqueCoders/LaravelContract/Contracts/Builder
This contract allow you to build objects more consistent. $wall->build()
, $door->build()
.
For your reference: Builder
CleaniqueCoders/LaravelContract/Contracts/Execute
Execute contract allow you to consistently call $object->execute()
. This contract usually use when we are triggering something to be execute after preparing the object.
CleaniqueCoders/LaravelContract/Contracts/Menu
Menu contract simpley return a list of menus that you can use to build your Sidebar, Navbar, etc.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.