viralsbackpack/backpackapi
Composer 安装命令:
composer require viralsbackpack/backpackapi
包简介
CRUD Api in Backpack
关键字:
README 文档
README
Quickly build an api interface for your Eloquent models, using Laravel 5. Erect a complete CMS at 10 minutes/model, max.
Features:
- Crud and search call api
- Back-end validation using Requests
- Easily overwrite functionality (customising how the create/update/delete process works is as easy as creating a new function with the proper name in your EntityCrudAPICrontroller)
Installation
composer require viralsbackpack/backpackapi
Setup
1. Command
_Create controller and add route for api:
php artisan backpack:crud-api name
This command will create NameAPICrudController in folder app/Http/Api and add route api route resource in routes/backpack/api.php
or particular command
_Create controller:
php artisan backpack:crud-api-controller Name
_Add route for api:
php artisan backpack-api:add-custom-route "BackPackAPI::resource('name', 'NameCrudAPIController');"
2. Setup api
All the settings below can be added to any method in the controller.
_Add validate request:
<?php $this->setRequestStoreApi(StoreRequest::class); $this->setRequestUpdateApi(UpdateRequest::class);
_Setup structure data in response
<?php // Set up structure of data in response $this->crud->setResponse([ 'id', 'name' //fields of its model ]);
or custom fields
<?php $this->crud->setResponse([ 'name' => function($entry) { return $entry->name . '123'; }, 'id' => function($entry) { return $entry->id . '123'; } ]);
_Set up extra data
<?php $this->crud->setExtraData([ 'test' => 123 ]);
_Set up return list entries after delete:
<?php $this->crud->setDeleteReturnList(true);
_Set message:
<?php $this->crud->setMessage('message');
_Set status:
<?php $this->crud->setStatus(123);
Usage
| Method | URI | Name | Action | Parameter obligatory | Form data obligatory |
|---|---|---|---|---|---|
| GET/HEAD | api/name | crud-api.name.index | App\Http\Controllers\Api\NameCrudAPIController@index | ||
| POST | api/name | crud-api.name.store | App\Http\Controllers\Api\NameCrudAPIController@store | ||
| POST | api/name/search | crud-api.name.search | App\Http\Controllers\Api\TagCrudAPIController@search | search[value] | |
| GET/HEAD | api/name/{id} | crud-api.name.show | App\Http\Controllers\Api\NameCrudAPIController@show | id | |
| PUT/PATCH | api/name/{id} | crud-api.name.update | App\Http\Controllers\Api\NameCrudAPIController@update | id | _method = PUT ; id |
| DELETE | api/name/{id} | crud-api.name.destroy | App\Http\Controllers\Api\NameCrudAPIController@destroy | id | _method = DELETE |
Credits
- [author name][manhhd@viralsoft.vn]
License
license. Please see the license file for more information.
viralsbackpack/backpackapi 适用场景与选型建议
viralsbackpack/backpackapi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 110 次下载、GitHub Stars 达 4, 最近一次更新时间为 2019 年 04 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「BackPackAPI」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 viralsbackpack/backpackapi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 viralsbackpack/backpackapi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 viralsbackpack/backpackapi 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
Joy BackpackApi
Laravel package for Accurate Online API integration.
Shared RCX Laravel DataTables UI and configuration helpers.
Boot a Laravel project on any machine with one command: app:serve installs missing tools (PHP, Node, Composer, Herd, Docker), creates .env, sets up the database, runs migrations, builds assets, starts a queue worker and serves via Herd, Sail or artisan serve; app:down cleanly stops everything it sta
Branded, diagnostic error pages (500, 403, 404, 419, 503) for Filament — native Filament UI, dark mode and translations out of the box.
统计信息
- 总下载量: 110
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-25

