Skip to content
EasyRdf is a PHP library designed to make it easy to consume and produce RDF.
PHP Makefile
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


EasyRdf is a PHP library designed to make it easy to consume and produce RDF. It was designed for use in mixed teams of experienced and inexperienced RDF developers. It is written in Object Oriented PHP and has been tested extensively using PHPUnit.

After parsing EasyRdf builds up a graph of PHP objects that can then be walked around to get the data to be placed on the page. Dump methods are available to inspect what data is available during development.

Data is typically loaded into a EasyRdf_Graph object from source RDF documents, loaded from the web via HTTP. The EasyRdf_GraphStore class simplifies loading and saving data to a SPARQL 1.1 Graph Store.

SPARQL queries can be made over HTTP to a Triplestore using the EasyRdf_Sparql_Client class. SELECT and ASK queries will return an EasyRdf_Sparql_Result object and CONSTRUCT and DESCRIBE queries will return an EasyRdf_Graph object.


$foaf = new EasyRdf_Graph("");
$me = $foaf->primaryTopic();
echo "My name is: ".$me->get('foaf:name')."\n";


The latest version of EasyRdf can be downloaded from GitHub.



  • PHP 5.2.1 or higher


  • API documentation written in phpdoc
  • Extensive unit tests written using phpunit
    • Automated testing against PHP 5.2, 5.3 and 5.4
  • Choice of RDF parser:
    • Built-in: RDF/JSON, N-Triples, RDF/XML
    • ARC2: RDF/XML, Turtle, RSS, microformats, eRDF, RDFa, ...
    • Redland Bindings: RDF/XML, N-Triples, Turtle, TriG, RSS Tag Soup, ...
    • rapper: RDF/XML, N-Triples, Turtle, TriG, RSS Tag Soup, ...
  • Choice of RDF serialiser:
    • Built-in: RDF/JSON, N-Triples, RDF/XML, Turtle
    • ARC2: RDF/JSON, RDF/XML, N-Triples, Turtle, POSHRDF
    • rapper: RDF/JSON, N-Triples, RDF/XML, Turtle, RSS, Atom, Dot, ...
  • Optional support for Zend_Http_Client
  • No required external dependancies upon other libraries (PEAR, Zend, etc...)
  • Complies with Zend Framework coding style.
  • Type mapper - resources of type foaf:Person can be mapped into PHP object of class Foaf_Person
  • Comes with a number of examples


The EasyRdf library and tests are licensed under a BSD-3-Clause license. The examples are in the public domain, for more information see UNLICENSE.

More Examples

Something went wrong with that request. Please try again.