PHPackages                             easyrdf/easyrdf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. easyrdf/easyrdf

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

easyrdf/easyrdf
===============

EasyRdf is a PHP library designed to make it easy to consume and produce RDF.

1.1.1(5y ago)62231.5M↓11.6%154[38 issues](https://github.com/easyrdf/easyrdf/issues)[10 PRs](https://github.com/easyrdf/easyrdf/pulls)20BSD-3-ClausePHPPHP &gt;=7.1.0

Since Oct 12Pushed 6mo ago32 watchersCompare

[ Source](https://github.com/easyrdf/easyrdf)[ Packagist](https://packagist.org/packages/easyrdf/easyrdf)[ Docs](http://www.easyrdf.org/)[ RSS](/packages/easyrdf-easyrdf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (25)Used By (20)

EasyRdf
=======

[](#easyrdf)

EasyRdf is a PHP library designed to make it easy to consume and produce [RDF](https://en.wikipedia.org/wiki/Resource_Description_Framework). 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 an [`EasyRdf\Graph`](https://www.easyrdf.org/docs/api/EasyRdf%5CGraph.html) object from source RDF documents, loaded from the web via HTTP. The [`EasyRdf\GraphStore`](https://www.easyrdf.org/docs/api/EasyRdf%5CGraphStore.html) 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`](https://www.easyrdf.org/docs/api/EasyRdf%5CSparql%5CClient.html) class. `SELECT` and `ASK` queries will return an [`EasyRdf\Sparql\Result`](https://www.easyrdf.org/docs/api/EasyRdf%5CSparql%5CResult.html) object and `CONSTRUCT` and `DESCRIBE` queries will return an [`EasyRdf\Graph`](https://www.easyrdf.org/docs/api/EasyRdf%5CGraph.html) object.

### Example

[](#example)

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

Downloads
---------

[](#downloads)

The latest *stable* version of EasyRdf can be [downloaded from the EasyRdf website](https://www.easyrdf.org/downloads).

Links
-----

[](#links)

- [EasyRdf Homepage](https://www.easyrdf.org/)
- [API documentation](https://www.easyrdf.org/docs/api)
- [Change Log](https://github.com/easyrdf/easyrdf/blob/main/CHANGELOG.md)
- [Source Code](https://github.com/easyrdf/easyrdf)
- [Issue Tracker](https://github.com/easyrdf/easyrdf/issues)

Requirements
------------

[](#requirements)

- PHP 7.1 or higher

Features
--------

[](#features)

- API documentation written in `phpdoc`
- Extensive unit tests written using `phpunit`
- Built-in parsers and serialisers: RDF/JSON, N-Triples, RDF/XML, Turtle
- Optional parsing support for: [ARC2](https://github.com/semsol/arc2/), [rapper](http://librdf.org/raptor/rapper.html)
- Optional support for [`Zend\Http\Client`](https://docs.zendframework.com/zend-http/client/intro/)
- No required external dependencies 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`
- Support for visualisation of graphs using [GraphViz](https://www.graphviz.org/)
- Comes with a number of examples

List of Examples
----------------

[](#list-of-examples)

- [`basic.php`](/examples/basic.php#slider) - Basic "Hello World" type example
- [`basic_sparql.php`](/examples/basic_sparql.php#slider) - Example of making a SPARQL `SELECT` query
- [`converter.php`](/examples/converter.php#slider) - Convert RDF from one format to another
- [`dump.php`](/examples/dump.php#slider) - Display the contents of a graph
- [`foafinfo.php`](/examples/foafinfo.php#slider) - Display the basic information in a FOAF document
- [`foafmaker.php`](/examples/foafmaker.php#slider) - Construct a FOAF document with a choice of serialisations
- [`graph_direct.php`](/examples/graph_direct.php#slider) - Example of using `EasyRdf\Graph` directly without `EasyRdf\Resource`
- [`graphstore.php`](/examples/graphstore.php#slider) - Store and retrieve data from a SPARQL 1.1 Graph Store
- [`graphviz.php`](/examples/graphviz.php#slider) - GraphViz rendering example
- [`html_tag_helpers.php`](/examples/html_tag_helpers.php#slider) - Rails Style html tag helpers to make the EasyRdf examples simpler
- [`httpget.php`](/examples/httpget.php#slider) - No RDF, just test `EasyRdf\Http\Client`
- [`open_graph_protocol.php`](/examples/open_graph_protocol.php#slider) - Extract Open Graph Protocol metadata from a webpage
- [`serialise.php`](/examples/serialise.php#slider) - Basic serialisation example
- [`sparql_queryform.php`](/examples/sparql_queryform.php#slider) - Form to submit SPARQL queries and display the result
- [`uk_postcode.php`](/examples/uk_postcode.php#slider) - Example of resolving UK postcodes using uk-postcodes.com
- [`wikidata_villages.php`](/examples/wikidata_villages.php#slider) - Fetch and information about villages in Fife from Wikidata
- [`zend_framework.php`](/examples/zend_framework.php#slider) - Example of using `Zend\Http\Client` with EasyRdf

Contributing
------------

[](#contributing)

We welcome any contributions. For further information please read [CONTRIBUTING.md](CONTRIBUTING.md).

For further information about extending / hack EasyRdf please read [DEVELOPER.md](DEVELOPER.md).

Running Examples
----------------

[](#running-examples)

The easiest way of trying out some of the examples is to use the PHP command to run a local web server on your computer.

```
php -S localhost:8080 -t examples

```

Then open the following URL in your browser:

Licensing
---------

[](#licensing)

The EasyRdf library and tests are licensed under the [BSD-3-Clause](https://www.opensource.org/licenses/BSD-3-Clause) license. The examples are in the public domain, for more information see [UNLICENSE](https://unlicense.org/).

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance45

Moderate activity, may be stable

Popularity71

Solid adoption and visibility

Community46

Growing community involvement

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 82.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~156 days

Recently: every ~44 days

Total

20

Last Release

1993d ago

Major Versions

0.9.x-dev → 1.0.0-rc.12020-07-08

PHP version history (3 changes)0.7.0PHP &gt;=5.2.8

0.10.0-alpha.1PHP &gt;=5.3.0

1.0.0-rc.1PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/caf7e2a5536fc746a8b33c6e1baa4b7d7dbeef6d0620d27b0836ca85b65beed7?d=identicon)[njh](/maintainers/njh)

---

Top Contributors

[![njh](https://avatars.githubusercontent.com/u/38734?v=4)](https://github.com/njh "njh (1241 commits)")[![indeyets](https://avatars.githubusercontent.com/u/13445?v=4)](https://github.com/indeyets "indeyets (161 commits)")[![k00ni](https://avatars.githubusercontent.com/u/381727?v=4)](https://github.com/k00ni "k00ni (20 commits)")[![scor](https://avatars.githubusercontent.com/u/77741?v=4)](https://github.com/scor "scor (16 commits)")[![alexpott](https://avatars.githubusercontent.com/u/769634?v=4)](https://github.com/alexpott "alexpott (7 commits)")[![hmaxs](https://avatars.githubusercontent.com/u/9107177?v=4)](https://github.com/hmaxs "hmaxs (6 commits)")[![coreation](https://avatars.githubusercontent.com/u/361244?v=4)](https://github.com/coreation "coreation (6 commits)")[![thiemowmde](https://avatars.githubusercontent.com/u/6576639?v=4)](https://github.com/thiemowmde "thiemowmde (5 commits)")[![bdecarne](https://avatars.githubusercontent.com/u/1277131?v=4)](https://github.com/bdecarne "bdecarne (5 commits)")[![ragol](https://avatars.githubusercontent.com/u/3726736?v=4)](https://github.com/ragol "ragol (4 commits)")[![osma](https://avatars.githubusercontent.com/u/1132830?v=4)](https://github.com/osma "osma (3 commits)")[![white-gecko](https://avatars.githubusercontent.com/u/1018168?v=4)](https://github.com/white-gecko "white-gecko (3 commits)")[![jaw111](https://avatars.githubusercontent.com/u/2478333?v=4)](https://github.com/jaw111 "jaw111 (3 commits)")[![jonphipps](https://avatars.githubusercontent.com/u/12743?v=4)](https://github.com/jonphipps "jonphipps (3 commits)")[![jbout](https://avatars.githubusercontent.com/u/5815304?v=4)](https://github.com/jbout "jbout (2 commits)")[![CloCkWeRX](https://avatars.githubusercontent.com/u/365751?v=4)](https://github.com/CloCkWeRX "CloCkWeRX (2 commits)")[![zerocrates](https://avatars.githubusercontent.com/u/298975?v=4)](https://github.com/zerocrates "zerocrates (2 commits)")[![moustaki](https://avatars.githubusercontent.com/u/2491?v=4)](https://github.com/moustaki "moustaki (2 commits)")[![balkian](https://avatars.githubusercontent.com/u/213135?v=4)](https://github.com/balkian "balkian (2 commits)")[![kizule](https://avatars.githubusercontent.com/u/28963303?v=4)](https://github.com/kizule "kizule (1 commits)")

---

Tags

phprdfsparqlRDFSemantic WebLinked DatasparqlrdfaTurtle

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/easyrdf-easyrdf/health.svg)

```
[![Health](https://phpackages.com/badges/easyrdf-easyrdf/health.svg)](https://phpackages.com/packages/easyrdf-easyrdf)
```

###  Alternatives

[sweetrdf/easyrdf

EasyRdf is a PHP library designed to make it easy to consume and produce RDF.

261.3M11](/packages/sweetrdf-easyrdf)[semsol/arc2

ARC2 is a PHP library for working with RDF. It also provides a MySQL-based triplestore with SPARQL support.

334250.0k15](/packages/semsol-arc2)[digitalbazaar/json-ld

A JSON-LD Processor and API implementation in PHP.

28555.4k1](/packages/digitalbazaar-json-ld)[pietercolpaert/hardf

A fast parser for RDF serializations such as turtle, n-triples, n-quads, trig and N3

37141.1k9](/packages/pietercolpaert-hardf)[aksw/erfurt

PHP/Zend based Semantic Web API for Social Semantic Software

426.6k1](/packages/aksw-erfurt)[benestar/asparagus

SPARQL abstraction layer for PHP

1554.9k5](/packages/benestar-asparagus)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
