Skip to content

Repository files navigation

Generic API Client

Provides a standard interface for accessing an API.

Installation

composer require digitickets/generic-api-client

Usage

<?php
require __DIR__.'/vendor/autoload.php';
use GenericApiClient\ApiClient;
$apiClient = new ApiClient('https://some-api.com);
$response = $apiClient->get('dogs'); // Returns a PSR ResponseInterface.
// You can get an array of data from the response object with this method:
$dogs = $apiClient->parseResponse($response);
print_r($dogs);
// Returns:
// Array
// (
// [0] => Array
// (
// [dogID] => 11
// [name] => Merlin

Testing

To install on PHP 8:

composer install --ignore-platform-reqs

To run tests:

composer test

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages