2017 © Pedro Peláez
 

library magic-api-php-wrapper

An awesome API PHP wrapper.

image

iarcadia/magic-api-php-wrapper

An awesome API PHP wrapper.

  • Tuesday, February 6, 2018
  • by iArcadia
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

MagicApiPhpWrapper

Packagist License Latest Stable Version Total Downloads, (*1)

This package is a POO-oriented AND procedural API PHP wrapper. With MagicApiPhpWrapper, you can easily obtain data from online API. The package includes a built-in caching system., (*2)

Installation

Require this package with composer:, (*3)

composer require iarcadia/magic-api-php-wrapper

POO-oriented usage

Overview

// "MAPW" stands for "Magic API PHP Wrapper"... of course!

// First, create your MAPW object with your configuration.
$api = new MAPW(
[
    'api.base_url' => 'https://www.your-awesome-url.com/api/',
    'api.key' => 'YourAwesomeApiKeyIfNeeded',
    'cache.use' => false,
    // ...
]);

// Second, get your data!
// Here, data will be from "https://www.your-awesome-url.com/api/countries":
$data = $api->get('countries');
// Here, data will be from "https://www.your-awesome-url.com/api/countries?from=Asia":
$data = $api->get('countries', ['from' => 'Asia']);
// Here, data will be from "https://www.your-awesome-url.com/api/cities?from=Spain&from=Italia":
$data = $api->get('https://www.your-awesome-url.com/api/cities?from=Spain&from=Italia');

Don't forget to include files or to use classes. (e.g. use iArcadia\MagicApiPhpWrapper\MAPW), (*4)

Procedural usage

Overview

// First, initialize the MAPW object with your configuration.
// In background, it will create a global variable with the newly created object : $GLOBALS['MAPW_INSTANCE'] = new MAPW(...)
mapw_initialize(
[
    'api.base_url' => 'https://www.your-awesome-url.com/api/',
    'api.key' => 'YourAwesomeApiKeyIfNeeded',
    'cache.use' => false,
    // ...
])

// Second, get your data!
// Here, data will be from "https://www.your-awesome-url.com/api/countries":
$data = mapw_get('countries');
// Here, data will be from "https://www.your-awesome-url.com/api/countries?from=Asia":
$data = mapw_get('countries', ['from' => 'Asia']);
// Here, data will be from "https://www.your-awesome-url.com/api/cities?from=Spain&from=Italia":
$data = mapw_get('https://www.your-awesome-url.com/api/cities?from=Spain&from=Italia');

Don't forget to include files., (*5)

CHANGELOGS

See CHANGELOGS.md, (*6)

The Versions

06/02 2018

1.0.0.x-dev

1.0.0.9999999-dev

An awesome API PHP wrapper.

  Sources   Download

MIT

The Requires

 

by Kévin Bibollet

api php wrapper

06/02 2018

dev-master

9999999-dev

An awesome API PHP wrapper.

  Sources   Download

MIT

The Requires

 

by Kévin Bibollet

api php wrapper

06/02 2018

1.0.0

1.0.0.0

An awesome API PHP wrapper.

  Sources   Download

MIT

The Requires

 

by Kévin Bibollet

api php wrapper