Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vectorface/api-client-php


https://github.com/vectorface/api-client-php

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

API-client-php
==============

A very simple/naive JSON/REST API client on top of cURL.

## Prerequisites
* Must have username, password and url for the REST API
* Must be running PHP >= 7.0

## Example

```PHP
'example',
'password' => '3x4mpl3',
'url' => 'http://domain.tld'
]);

/*
* This will:
* - Make a request to
* http://domain.tld/users?filters=fname:Jon&fields=user_id,fname,lname
* - JSON-decode the response
* - return the result
*/
$response = $api->request('/users', [
'filters' => 'fname:Jon',
'fields' => 'user_id,fname,lname'
]);

// $response should contain a decoded JSON response from the API
```