laravel-contracts maintained by cwccode
: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();
}