定制 clarity-tech/laravel-ezyslips 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

统计信息

  • 总下载量: 180
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固