EasyRDF: A PHP library designed to make it easy to consume and produce RDF

https://www.easyrdf.org/

Example

$foaf = new EasyRdf\Graph("http://njh.me/foaf.rdf");
$foaf->load();
$me = $foaf->primaryTopic();
echo "My name is: ".$me->get('foaf:name')."\n";

Requirements

  • PHP 7.1 or newer
  • The pcre extension (enabled by default)
  • The mbstring extension (usually available)

Features

  • Extensive unit tests written using PHPUnit
  • Built-in parsers and serialisers: RDF/JSON, N-Triples, RDF/XML, Turtle
  • Optional parsing support for: ARC2 and rapper
  • Optional support for Zend\Http\Client
  • No required external dependancies upon other libraries (PEAR, Zend, etc…)
  • Complies with the PSR-12 coding style
  • Type mapper – resources of type foaf:Person can be mapped into PHP object of class Foaf\Person
  • Support for visualisation of graphs using GraphViz
  • Composer compatible
  • Comes with a number of examples