Code Monkey home page Code Monkey logo

guzzletool's Introduction

GuzzleTool

多资源网络请求,用于微服务请求,Oauth2.0 请求,Composer包

安装依赖

composer require guzzlehttp/guzzle

composer require liaosp/guzzle-tool

使用方法:继承这个类。

配置资源地址:

比如在yaconf 中配置:

[resources]
goods='http://devzuul.22.com/api/php/product'
order='http://devzuul.22.com/api/php/order'
oauth='http://devoauth.22.com'
personal='http://devzuul.22.com/api/authorize'
class Resources extends ResourcesTool
{
    private $resources;
    /*
     * 微服务url 资源。
     *
     */
    public function __construct($resources = 'goods')
    {
        //配置服务信息。
        $this->ServicesUrl = yaconf('resources');
        parent::__construct($resources);
    }


}

使用方法: (new Resources('personal'))->json()->get('/users/WARE/add');

请求头名: Authorization

更新日志:

1.0 测试环境

2.0 生产环境

2.0.2 去掉 Bearer 拼接

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.