GithubHelp home page GithubHelp logo

devronhansen / guzzle-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dylan-dpc-zz/guzzle-client

0.0 1.0 0.0 19 KB

A Simple Guzzle Client for a Laravel application

License: MIT License

PHP 100.00%

guzzle-client's Introduction

What is this?

MIT licensed Latest Stable Version

A Simple Guzzle Client for a Laravel application

Requirements

Installation

Via composer

$ composer require dpc/guzzle-client

After installation, publish the vendor files by running:

php artisan vendor:publish --provider="Dpc\GuzzleClient\GuzzleClientServiceProvider"

This will create a guzzle.php in the config directory which will contain:

return [
    'base_uri' => '',
];

Usage

Inject the contract into the class where you need the client:

   protected $client;
   /**
     * Request constructor.
     * @param RequestClientContract $client
     */
    public function __construct(RequestClientContract $client)
    {
        $this->client = $client;
    }

You can then use the client by:

  $client->send('POST', 'foo/bar',[
              'foo' => 'random data'
            ])->asJson()->json());

The asJson() method will send the data using json key in the Guzzle request. (You can use asFormParams() to send the request as form params).

Versioning

This package follows semver. Features introduced & any breaking changes created in major releases are mentioned in releases.

Support

This package is created as a basic wrapper for Guzzle based on what I needed in a few projects. If you need any other features of Guzzle, you can create a issue here or send a PR to master branch.

If you need help or have any questions you can:

Authors

Dylan DPC

License

The MIT License (MIT)

Copyright (c) 2017 Dylan DPC

guzzle-client's People

Contributors

dylan-dpc avatar pajoda avatar tarlepp avatar wotta avatar

Watchers

 avatar

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.