PHPackages                             mgr-paddle/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. mgr-paddle/easyrdf

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

mgr-paddle/easyrdf
==================

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

02.0k↓50%PHP

Since Oct 7Pushed 1y agoCompare

[ Source](https://github.com/mgr-paddle/easyrdf)[ Packagist](https://packagist.org/packages/mgr-paddle/easyrdf)[ RSS](/packages/mgr-paddle-easyrdf/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

EasyRdf (Fork)
==============

[](#easyrdf-fork)

[![CI](https://github.com/sweetrdf/easyrdf/workflows/Tests/badge.svg)](https://github.com/sweetrdf/easyrdf/workflows/Tests/badge.svg)

About this fork 🚀
-----------------

[](#about-this-fork-)

This is a fork of EasyRdf which I maintain in my spare time. My objective is to keep EasyRdf alive and usable on latest PHP versions. Code is more or less maintained but not developed any further. If you wanna participate, feel free to open a pull request! For more information about this fork, scroll at the end of this document.

About EasyRdf
-------------

[](#about-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` 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.

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";
```

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

[](#requirements)

- PHP 8.0 or higher
- PHP Extensions: dom, mbstring, pcre, xmlreader
- PHP Libs: libxml

Features
--------

[](#features)

- No required external dependencies upon other libraries (PEAR, Zend, etc...)
- Library runs in Linux and Windows environments
- 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 `Laminas\Http\Client`, `Zend\Http\Client` and `GuzzleHttp\Client`
- 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)

**Contributions are welcome!** Please read [CONTRIBUTING.md](/CONTRIBUTING.md) for further information.

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

Further mainainers are possible, please send an email to [@k00ni](https://github.com/k00ni).

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:

Why this fork? (written in late 2020)
-------------------------------------

[](#why-this-fork-written-in-late-2020)

EasyRdf was in maintenance mode since 2017 ([link](https://github.com/easyrdf/easyrdf/issues/282)) and not actively maintained since. There were 6+ pull requests pending at that time with fixes and new features. Its sad to see another RDF PHP project die slowly, so I decided to clean house and give the code a new home ([further info](https://github.com/easyrdf/easyrdf/issues/320)). A few months in late 2020 EasyRdf was actively improved (me being a co-maintainer for a while), but that stopped and decay began again. It was a frustating time, lets leave it at that.

In the end I decided to abandon my old fork and start fresh with latest EasyRdf improvements in this repository.

#### What can you expect as a user?

[](#what-can-you-expect-as-a-user)

This fork (v1.\*) aims to be a drop-in replacement for the `easyrdf/easyrdf` package, which means, you can use it **without changing your code**. *But you should still read the notes of the latest release, to make sure nothing unexpected happens after an update.*

#### What can you expect as an EasyRdf developer?

[](#what-can-you-expect-as-an-easyrdf-developer)

This repository is set up in a way to lower the maintenance overhead in comparison to the original version. Test related tools were partly replaced with more lightweight solutions. Furthermore this repository is held by an organization instead of a user, which allows more flexible maintenance.

#### Whats next? Whats my plan?

[](#whats-next-whats-my-plan)

As stated above, main objective is to keep EasyRdf's legacy code up to date and compatible with latest PHP versions. I welcome pull requests and try to react as fast as possible. If there are useful pull requests in easyrdf/easyrdf (and I have time to spare), I will picked them up and integrate them here (for instance [sweetrdf#9](https://github.com/sweetrdf/easyrdf/pull/9), [sweetrdf#14](https://github.com/sweetrdf/easyrdf/pull/14)).

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

24

—

LowBetter than 32% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 Bus Factor1

Top contributor holds 78.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b731c61de357accd314dc165ff2e91ff0d50b0b7237bd88de320ec164a84589?d=identicon)[michel.g](/maintainers/michel.g)

---

Top Contributors

[![njh](https://avatars.githubusercontent.com/u/38734?v=4)](https://github.com/njh "njh (1230 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 (88 commits)")[![scor](https://avatars.githubusercontent.com/u/77741?v=4)](https://github.com/scor "scor (16 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)")[![alexpott](https://avatars.githubusercontent.com/u/769634?v=4)](https://github.com/alexpott "alexpott (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)")[![Michiel-s](https://avatars.githubusercontent.com/u/7961582?v=4)](https://github.com/Michiel-s "Michiel-s (4 commits)")[![osma](https://avatars.githubusercontent.com/u/1132830?v=4)](https://github.com/osma "osma (3 commits)")[![jonphipps](https://avatars.githubusercontent.com/u/12743?v=4)](https://github.com/jonphipps "jonphipps (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)")[![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)")[![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)")

### Embed Badge

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

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

PHPackages © 2026

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