citeq/php-api-wrapper
Composer 安装命令:
composer require citeq/php-api-wrapper
包简介
Work with APIs like with Laravel Eloquent or Doctrine (no longer a dream)
README 文档
README
This is a fork of the cristal/php-api-wrapper package with extended filter functions. Because the extended functions are only available
for the laravel framework, they are currently provided in this own fork and haven't been contributed back yet.
PHP API Wrapper is a smart stack based on a couple of a Transport and a smart Wrapper for your API. It is designed to be easily integrated into your projects thanks to bridges for Laravel, Symfony, API Platform and a standalone stack.
🚀 Installation using Composer
composer require citeq/php-api-wrapper
👀 Quick view
<?php // Configure your API use Cristal\ApiWrapper\Model; use Cristal\ApiWrapper\Transports\Basic; use App\User; use Curl\Curl; $transport = new Basic('username', 'password', 'http://api.example.com/v1/', new Curl); $api = new Api($transport); Model::setApi($api); // Use your model like Eloquent (Usage with Symfony is significantly different) $activedUsers = User::where(['active' => true])->get(); foreach($activedUsers as $user){ $user->active = false; $user->save(); }
📖 Chose your stack
👉 Start wihout Laravel or Symfony
If you decide to work without Laravel or Symfony, PHP Api Wrapper comes with a standalone Builder and a Model largely inspired by Eloquent, but really standalone. I promise !
Start without Laravel or Symfony
👉 Start with Laravel
This is actualy the powerfull usage of API Wrapper. If you decide to use PHP API Wrapper with Laravel the integration approaches perfection. The builder returns Collections, all models are usable with the Laravel Route Binding (this is really impressive). And icing on the cake, you can create complexes relations between Eloquent and PHP API Wrapper.
👉 Start with Symfony (and optionally Api Platform)
This implementation is realy interesting too, the Symfony bridge provide you a Repository implementing the Doctrine RepositoryInterface which hydrates your entities. A Manager is also available which allows you to manage repositories and its connections. If you are using API Platform this is fully compatible. A API Platform Data Provider is also registered.
⚠️ Careful, this implementation is currently read-only. Help us to implement the missing parts !
citeq/php-api-wrapper 适用场景与选型建议
citeq/php-api-wrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.59k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 08 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 citeq/php-api-wrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 citeq/php-api-wrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-12