ventom/flutter-api-package
Composer 安装命令:
composer require ventom/flutter-api-package
包简介
A package to integrate API for Flutter app.
README 文档
README
Overview
The MakeFlutterCommand package provides a Laravel artisan command to generate essential files and structure for a Flutter component in a Laravel project. This command streamlines the development process by automatically creating the necessary resources, migrations, models, controllers, and routes, following Laravel's best practices.
Installation
1. Require the Package
To get started, you need to require the package in your Laravel project using Composer:
composer require ventom/make-flutter-command
2. Service Provider (If Not Auto-Discovered)
If ventom package is not auto-discovered by Laravel, you need to manually register the service provider. Open the config/app.php file and add the service provider to the providers array:
'providers' => [
// Other Service Providers
Vendor\Package\FlutterServiceProvider::class,
]
3. Publish Configuration (Optional)
If your package includes configuration files that need to be published to the Laravel application's config directory, you can publish them using the following command:
php artisan vendor:publish --provider="Vendor\Package\FlutterServiceProvider"
Usage
Make a Flutter Component
You can generate a Flutter component using the following artisan command:
php artisan make:flutter {name} {--seeder}
{name}: The name of the component you want to create.--seeder: (Optional) If this option is provided, a seeder file will also be generated.
Example
To create a Flutter component named "Product" and include a seeder, use the command:
php artisan make:flutter Product --seeder
This command will create the following files and updates:
- Resource:
app/Http/Resources/ProductResource.php - Migration:
database/migrations/xxxx_xx_xx_create_products_table.php - Helper:
app/Helpers/ProductHelper.php - Model:
app/Models/Product.php - Controller:
app/Http/Controllers/Api/ProductController.php - Routes: Adds RESTful API routes in
routes/api.php - Seeder: (If
--seederis provided)database/seeders/ProductSeeder.php
Generated Controller Actions
The package creates a controller with the following actions:
- json(): Fetches all instances of the model and returns them as a JSON response.
- show($id): Fetches a specific instance by its ID.
- store(Request $request): Stores a new instance in the database.
- update(Request $request, $id): Updates an existing instance by its ID.
- destroy($id): Deletes an instance by its ID.
Generated API Routes
The generated routes can be found in routes/api.php and include:
Route::prefix('products')
->controller(App\Http\Controllers\Api\ProductController::class)
->group(function () {
Route::get('/json', 'json');
Route::get('/{id}', 'show');
Route::post('/', 'store');
Route::put('/{id}', 'update');
Route::delete('/{id}', 'destroy');
});
Changelog
All notable changes to this project will be documented in this section.
Contributing
If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are welcome.
License
This package is open-source software licensed under the MIT license.
ventom/flutter-api-package 适用场景与选型建议
ventom/flutter-api-package 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ventom/flutter-api-package 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ventom/flutter-api-package 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-26