Giter Site home page Giter Site logo

apiaxle-module's Introduction

ApiAxle Module

Travis-CI Build Status Coverage Status

Introduction

ApiAxle The Open Source API Management Platform

ApiAxle is a proxy that sits on your network, in front of your API(s) and manages things that you shouldn't have to, like rate limiting, authentication and caching. It's fast, open and easy to configure.

Requirements

Features / Goals / TODO

  • Readily consumable, configuration based, object oriented library
  • Support for Api objects
  • Support for Key objects
  • Support for Keyring objects
  • Set up continuous integration with Travis-CI: (https://travis-ci.org/fillup/apiaxle-module)
  • Create objects to represent stats, charts, etc?
  • Fix serialization of PHP boolean to string for ApiAxle API. Currently API wants string of either true or false, but serializing PHP boolean results in 0 or 1.
  • Add support for new features in ApiAxle 1.11 to support capturing path statistics

Installation

Using Composer - Recommended

  1. Edit your composer file to include:
{
    "require": {
        "php": ">=5.3.3",
        "fillup/apiaxle": "dev-master"
    }
}
  1. Update composer install with php composer.phar update

  2. Make sure you are including the composer autoload file:

include_once './vendor/autoload.php';
  1. Use the library however you need. See examples below.

Usage Examples

  1. Create a new API, create a new Key, give Key access to API
<?php
    include_once 'vendor/autoload.php';
    
    use ApiAxle\Api\Api;
    use ApiAxle\Api\Key;

    $apiDetails = array(
        'endPoint' => 'api.mydomain.com/api',
        'protocol' => 'https',
    );    
    
    $api = new Api();
    $api->create('myapi',$apiDetails);

    $keyDetails = array(
        'sharedSecret' => 'thisismyreallyshortsecret',
        'qps' => 10,
        'qpd' => 1000,
    );
    
    $key = new Key();
    $key->create('keyvalue',$keyDetails);
    
    $api->linkKey($key);

    // Thats it, your API is registered with API axle, your Key is created,
    // and your Key has access to the new API

API Documentation

API documentation generated from phpDocs by apigen is available in the docs/ folder.

Using a Proxy

You can configure the library to use a proxy if needed for debugging or otherwise. I've used it with Charles Proxy many times to debug my calls and responses from ApiAxle. To configure it to use a proxy, simply set these attributes in the configuration:

    'proxy_enable' => true,
    'proxy_host' => '127.0.0.1',
    'proxy_port' => '8888',

Using your own CA Certs

If you are running in an environment where you have your own CA and want to validate the certs, you can configure this library to specify where to find the CA info or a path to a folder with certs. This uses the curl_setopt features in PHP to set these. In order for them to work though, the ssl_verifypeer setting needs to be true:

    'ssl_verifypeer' => true,
    'ssl_cainfo' => null,
    'ssl_capath' => '/etc/pki/tls/certs/',

Contributing

If you are interested in contributing to this library and/or extending it please let me know, I'd love to work with others on this to help consider other use cases and design patterns.

Exceptions

100-199: Configuration Related Exceptions

200 - 299: API call related exceptions

apiaxle-module's People

Contributors

fillup avatar forevermatt avatar

Watchers

James Cloos avatar 0xsatoshis avatar  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.