2017 © Pedro Peláez
 

library hatebase

Hatebase is a PHP HTTP client library for consuming the Hatebase API

image

awelters/hatebase

Hatebase is a PHP HTTP client library for consuming the Hatebase API

  • Wednesday, October 12, 2016
  • by awelters
  • Repository
  • 4 Watchers
  • 6 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Hatebase API Wrapper

Simple PHP wrapper for v3.0 of the hatebase.org API, (*1)

How to use

  1. Obtain a hatebase API key
  2. Install composer
  3. Create a new composer.json file with awelters/hatebase as a dependency (or add to your project's existing composer.json file)
{
    "require": {
        "awelters/hatebase": "dev-master"
    }
}
  1. Use composer to install the dependencies
  2. Go ahead and try it out. The following php script can be used as a starting point by simply adding your Hatebase API key
<?php
/**
* Andrew's Hatebase script : Simple script to retrieve results from Hatebase API
*
* @category Awesomeness
* @date 3/03/2014
* @author Andrew Welters <awelters@hugmehugyou.org>
* @license http://opensource.org/licenses/MIT The MIT License
* @link http://www.hatebase.org/connect_api
* @link https://github.com/awelters/hatebase
*/
ini_set('display_errors', 1);
header('Content-type: application/json');

require_once __DIR__ . '/vendor/autoload.php'; // Autoload files using Composer autoload

use Hatebase\HatebaseAPI;

$settings = array(
    'key' => '',
    'version' => '3' //optional
);
$hatebase = new HatebaseAPI($settings);

//See http://www.hatebase.org/connect_api for filter options
$filters = array('about_nationality' => '1', 'language' => 'eng');
$output = 'json'; //either 'xml' or 'json', 'xml' is faster
$query_type = 'sightings'; //either 'vocabulary' or 'sightings'

try {
    $result = $hatebase->performRequest($filters, $output, $query_type);
    print_r($result);
}
catch(Exception $e) {
    echo 'Error: '.$e;
}

The Versions

12/10 2016

dev-master

9999999-dev https://github.com/awelters/hatebase

Hatebase is a PHP HTTP client library for consuming the Hatebase API

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *

 

api curl hatebase