cwccode / laravel-contracts
此包已被弃用且不再维护。未建议替代包。
Laravel artisan 命令,用于创建接口
v1.0.2
2018-08-07 20:31 UTC
Requires
- laravel/framework: >=5.0
Requires (Dev)
- roave/security-advisories: dev-master
This package is not auto-updated.
Last update: 2021-10-04 10:51:18 UTC
README
cwccode/laravel-contracts
是一个Laravel包,它添加了一个 make:contract
命令,用于创建应用程序的接口。
安装
您可以使用composer安装此包
composer require --dev cwccode/laravel-contracts
对于Laravel 5.4或更低版本,您需要手动在 /config/app.php 中注册服务提供者
用法
要创建一个新的接口,只需运行
php artisan make:contract InterfaceName
这将在 app/Contracts/InterfaceName.php
中生成以下文件
<?php namespace App\Contracts; interface InterfaceName { // }
您也可以通过传递一个或多个 --method
选项来指定一些方法
php artisan make:contract InterfaceName --method=method1 --method=method2
这将生成
<?php namespace App\Contracts; interface InterfaceName { /** * method1 * * @return void */ public function method1(); /** * method2 * * @return void */ public function method2(); }