Simple PHP wrapper for v3.0 of the API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Hatebase API Wrapper

Simple PHP wrapper for v3.0 of the API

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
* Andrew's Hatebase script : Simple script to retrieve results from Hatebase API
* @category Awesomeness
* @date 3/03/2014
* @author Andrew Welters <>
* @license The MIT License
* @link
* @link
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 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);
catch(Exception $e) {
	echo 'Error: '.$e;