phfoxer / apigenerate
为 Laravel 框架提供简单的 API 生成。
2.8.5
2023-03-03 02:04 UTC
Requires
- php: >=7.1
- doctrine/dbal: ^2.10.2
README
Laravel 框架的 API Rest 生成器。只需使用您的数据库表名或连接名,即可在几秒钟内创建您的 API 资源。
安装
composer require phfoxer/apigenerate
安装服务提供者
// config/app.php 'providers' => [ ... Phfoxer\ApiGenerate\ApiGenerateServiceProvider::class, ... ];
用法
创建新的资源
要创建所有 API Rest 资源,请运行此命令(仅适用于 postgres 和 mysql)
php artisan generate:api --con=conection_name
要创建新的 API 资源,请运行此命令
php artisan generate:api --table=table_name --relation=true
您可以在 https://:8000/api/table_name 中看到结果。您可以在 app/RestAPI 中找到您的新资源。General 是默认的
参数
定义路由
php artisan generate:api --table=table_name --route=my-custom-route --relation=true
定义模块名称
php artisan generate:api --table=table_name --route=my-custom-route --relation=true
您可以在 app/RestAPI/Exemple 中找到您的新资源。
Postcardware
您可以使用此包,因为它遵循 MIT 许可