This package is abandoned and no longer maintained. No replacement package was suggested.

A simple but thorough PHP client for working with Freebase API

1.0.0 2014-01-14 08:24 UTC


Phreebase provides a nice API for all the features on Google's Freebase API.


Phreebase works with PHP 5.4.0 or later.

You really shoud be using PHP 5.4.0 or later, but if you're not using it just yet, feel free to fork the code and replace array notation from [] to array() and it shoud work.


The recommended and covered way of installation is through Composer.

To install Phreebase using composer you need to:

  1. Make sure you already have composer.phar on your project root folder. If not run, go to you project root folder and run:

    curl -s | php

  2. Create a composer.json file in your project root folder:

  	"require": {
      	"brunomvsouza/phreebase": "dev-master"
  1. Finally install Phreebase through Composer:

    php composer.phar install


Full introduction to the Phreebase API.

At first you need to require composer's autoloader:

require_once '/path/to/vendor/autoload.php';

Instanciate Phreebase class giving the your Google's Freebase API Key (more info on how to get an API Key):

$phreebase = new Phreebase('__YOUR_FANCY_API_KEY__');

Make searches through plain strings with the search() method:

// Full parameters list here
    'query' => 'Tropa de Elite',
    'filter' => '(any type:/people/person)'

Make searches through MQL Queries with the mqlRead() method:

// Full parameters list here
        'id' => null,
        'name' => null,
        'type' => '/astronomy/planet'

Write on Freebase through MQL Queries with the mqlWrite() method:

// To write on Freebase you need to ask for additional quota on
// Full parameters list here

Get a topic with the topic() method:

// Full parameters list here
$phreebase->topic('/m/0463dr7', [
    'lang' => 'pt'

More Information

I told it was simple. :) There is no more information to give (I think). If you have any questions, the code is your friend.

If the code don't give you the answer feel free to ask through an issue.


Phreebase is licensed under the MIT license.