Code Monkey home page Code Monkey logo

loco's Introduction

Loco SDK for PHP

Installation

Installation is via Composer.

Add the latest stable version of loco/loco to your project's composer.json file as follows:

"require": {
  "loco/loco": "^2.0"
}

REST API Client

The SDK includes a REST client for the Loco API.

Client usage

The client is built on Guzzle. Basic usage is to construct with your API key and call the endpoint methods directly. The following example simply verifies your credentials:

$client = Loco\Http\ApiClient::factory(['key' => 'your_api_key']);
$result = $client->authVerify();
printf("Authenticated as '%s'\n", $result['user']['name']);

See the example directory for more.

Advanced options

Additionally the ApiClient::factory method can take any arguments accepted by Guzzle's client constructor. See Request Options and Handlers and Middleware for full details.

Command Line Client

A Console interface supporting all methods of the Loco API is at bin/console. Just run it to see all the available options.

The console reads from config.json, but you can override your API key from the command line. Run the following to verify your credentials:

bin/console loco:auth:verify -v -k <your_api_key> 

Documentation

Breaking changes in v2.0

Updating from Guzzle 3 to Guzzle 6 brought some necessary breaking changes with it. If you're upgrading from 1.0.18, please note the following:

  • The structure of config.json has changed. Note in particular a single root object containing your values as per the example config.
  • The version number of the SDK is no longer synced to the version of the API. Each release will however be built against the latest version of the live service.

loco's People

Contributors

andvla 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.