bekwoh/laravel-contract

This package is abandoned and no longer maintained. The author suggests using the https://github.com/cleaniquecoders/laravel-contract/ package instead.

Common Contracts for Laravel

1.3.0 2024-03-21 03:55 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.