New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

cleaniquecoders/laravel-contract

Common Contracts for Laravel
5,031
Install
composer require cleaniquecoders/laravel-contract
Latest Version:1.5.0
PHP:^8.1 | ^8.2 | ^8.3 | ^8.4
Laravel:9 – 13
License:MIT
Last Updated:Mar 31, 2026
Links: GitHub  ·  Packagist
Maintainer: nasrulhazim.m

Common Contracts for Laravel

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.

Related Packages

cleaniquecoders/laravel-running-number

Generate running number when creating new records in your table.

18,002 4
cleaniquecoders/laravel-db-doc

Generate Database Schema Documentation

7,947 4
cleaniquecoders/mailhistory

Keep track all the emails sent in the your Laravel application.

4,508 2

Version History

Version Released PHP Laravel License
1.5.0 ^8.1 | ^8.2 | ^8.3 | ^8.4 ^9.0 | ^10.0 | ^11.0 | ^12.0 | ^13.0 MIT
1.4.0 ^8.1 | ^8.2 | ^8.3 | ^8.4 ^9.0 | ^10.0 | ^11.0 | ^12.0 MIT
1.3.0 ^8.1 | ^8.2 | ^8.3 ^9.0 | ^10.0 | ^11.0 MIT
1.2.0 ^8.1 ^9.0 | ^10.0 MIT
1.1.0 ^8.1 ^10.0 MIT