clarity-tech/laravel-ezyslips
Composer 安装命令:
composer require clarity-tech/laravel-ezyslips
包简介
Laravel ezyslips package
README 文档
README
Laravel Ezyslips is a simple package which helps to build robust integration into Ezyslips.
Installation
Add package to composer.json
composer require clarity-tech/laravel-ezyslips
Laravel 5.5+
Package auto discovery will take care of setting up the alias and facade for you
Laravel 5.4 <
Add the service provider to config/app.php in the providers array.
<?php 'providers' => [ ... ClarityTech\Ezyslips\EzyslipsServiceProvider::class, ],
Setup alias for the Facade
<?php 'aliases' => [ ... 'Ezyslips' => ClarityTech\Ezyslips\Facades\Ezyslips::class, ],
Set credendials
in your .env file set these values from your app
EZYSLIPS_EMAIL=your-email
EZYSLIPS_LICENSE_KEY=your-license-key
Optional Configuration (Publishing)
Laravel Ezyslips requires you to set email and license key configuration. You will need to publish configs assets
`php artisan vendor:publish --tag=ezyslips-config`
This will create a ezyslips.php file in the config directory.
'key' => env("EZYSLIPS_EMAIL", null),
'secret' => env("EZYSLIPS_LICENSE_KEY", null)
Usage
Just set the env and use the Ezyslips facade or resolve it in the container
use ClarityTech\Ezyslips\Facades\Ezyslips; return Ezyslips::api()->order->create( $attributes );
Controller Example
If you prefer to use dependency injection over facades like me, then you can inject the Class:
use Illuminate\Http\Request; use ClarityTech\Ezyslips\Ezyslips; class Foo { protected $ezyslips; public function __construct(Ezyslips $ezyslips) { $this->ezyslips = $ezyslips; } /* * returns a single order */ public function getOrder(Request $request) { $orders = $this->ezyslips ->order->fetch(['orderid' => 40586]); } /* * returns the array of orders */ public function getOrder(Request $request) { $orders = $this->ezyslips ->order->all(['status' => 'A']); } /* * Advanced use case call the api directly * with specifying the prefix * returns the raw responses */ public function getOrder(Request $request) { $orders = $this->ezyslips ->get('getorders'); } }
Miscellaneous
To get Response headers
Ezyslips::getHeaders();
To get specific header
Ezyslips::getHeader("Content-Type");
Check if header exist
if(Ezyslips::hasHeader("Content-Type")){ echo "Yes header exist"; }
To get response status code or status message
Ezyslips::getStatusCode(); // 200 Ezyslips::getReasonPhrase(); // ok
clarity-tech/laravel-ezyslips 适用场景与选型建议
clarity-tech/laravel-ezyslips 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 180 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 11 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 clarity-tech/laravel-ezyslips 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 clarity-tech/laravel-ezyslips 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 180
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-11