A simple package to handle common contracts.
You can install the package via composer:
composer require cleaniquecoders/laravel-contract
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.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.