Looking to hire Laravel developers? Try LaraJobs

laravel-contracts maintained by cwccode

Description
A Laravel artisan command to make interfaces
Author
Last update
2018/08/07 22:31 (dev-master)
License
Links
Downloads
4 372

Comments
comments powered by Disqus

:warning: This package has been abandonned.

I can't promise it will get baked into Laravel, but it has popped up on Taylor Otwell's radar, so it could happen 🤞

Laravel Contract Command

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();
}