cwccode/laravel-contracts

This package is abandoned and no longer maintained. No replacement package was suggested.

A Laravel artisan command to make interfaces

v1.0.2 2018-08-07 20:31 UTC

This package is not auto-updated.

Last update: 2021-10-04 10:51:18 UTC


README

cwccode/laravel-contracts is a package that adds a make:contract command to Laravel, to create interfaces for your application.

Installation

You can install the package using composer:

composer require --dev cwccode/laravel-contracts

For Laravel 5.4 or less, you'll need to register the service provider manually in /config/app.php

Usage

To make a new interface, simply run:

php artisan make:contract InterfaceName

This will produce the following file in app/Contracts/InterfaceName.php:

<?php

namespace App\Contracts;

interface InterfaceName
{
    //
}

You can also specify some methods by passing one or more --method options:

php artisan make:contract InterfaceName --method=method1 --method=method2

This will produce:

<?php

namespace App\Contracts;

interface InterfaceName
{
    /**
     * method1
     *
     * @return void
     */
    public function method1();

    /**
     * method2
     *
     * @return void
     */
    public function method2();
}