PHPackages                             sweetrdf/quick-rdf-io-raptor - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. sweetrdf/quick-rdf-io-raptor

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

sweetrdf/quick-rdf-io-raptor
============================

Allows access to Raptor RDF parsing and serializing utility (https://librdf.org/raptor/rapper.html).

1.1.0(8mo ago)020MITPHPPHP &gt;=8.0CI passing

Since May 3Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/sweetrdf/quickRdfIo-Raptor)[ Packagist](https://packagist.org/packages/sweetrdf/quick-rdf-io-raptor)[ RSS](/packages/sweetrdf-quick-rdf-io-raptor/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

Raptor Parser (RDF)
===================

[](#raptor-parser-rdf)

It provides a RDF parser using `rapper` command line tool from [Raptor RDF parsing and serializing utility](https://librdf.org/raptor/rapper.html). The generated internal PHP-representations (quads, ...) are compatible to  and can be used together with other rdfInterface implementations, such as [quickRdfIo](https://github.com/sweetrdf/quickRdfIo) to serialize RDF in another format, for instance.

Installation
------------

[](#installation)

### Requirements

[](#requirements)

- PHP 8.0+
- Raptor RDF parser utility is installed (we need its `rapper` command line tool); its usually not part of the default installation
    - on Debian/Ubuntu: run `apt-get install raptor2-utils`
    - Package might be namend differently in other Linux distributions

### Composer

[](#composer)

Install it using Composer: `composer require sweetrdf/quick-rdf-io-raptor`.

You **need** an implementation of rdfInterfaces, such as quickRdf. For starters, just use `composer require sweetrdf/quick-rdf`

Usage
-----

[](#usage)

**Note:** We are using rdfInterface implementations from  in the following. Make sure you installed the package before running the code.

### Parsing

[](#parsing)

**Parse a file:**

```
use \quickrdf\DataFactory;
use \quickRdfIo\Raptor\Parser;

// create a file handle for a n-quads/n-triple file
$fileHandle = fopen('/path/to/n-quads-file.nq', 'r');

// init a parser instance and read file handle
$parser = new Parser(new DataFactory());
$quadsIterator = $parser->parseStream($fileHandle);

// iterate through the quads
// note: the file isn't read before, only as you iterating $quadIterator
foreach ($quadsIterator as $quad ) {
    var_dump($quad);
}

// free file handle
fclose($fileHandle);
```

**Parse a string:**

```
use \quickrdf\DataFactory;
use \quickRdfIo\Raptor\Parser;

$str = '_:foo   .';

// init a parser instance and read RDF string
$parser = new Parser(new DataFactory());
$quadsIterator = $parser->parse($str);

// iterate through the quads
foreach ($quadsIterator as $quad ) {
    var_dump($quad);
}
```

Caveats and known issues
------------------------

[](#caveats-and-known-issues)

When using this class keep the following in mind:

- The `Parser` class is basically a wrapper around the `rapper` command, which means input must be prepared for further processing (may impact performance). A readable local file as source is needed as well as a local file for generated N-Quads output, which is used for the internal NQuads parser later on.

License
-------

[](#license)

[MIT](./LICENSE)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance60

Regular maintenance activity

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~179 days

Total

4

Last Release

254d ago

### Community

Maintainers

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

---

Top Contributors

[![k00ni](https://avatars.githubusercontent.com/u/381727?v=4)](https://github.com/k00ni "k00ni (14 commits)")

---

Tags

parserserializerRDFTurtlen-triplesn-quadsrdf-xml

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sweetrdf-quick-rdf-io-raptor/health.svg)

```
[![Health](https://phpackages.com/badges/sweetrdf-quick-rdf-io-raptor/health.svg)](https://phpackages.com/packages/sweetrdf-quick-rdf-io-raptor)
```

###  Alternatives

[nikic/php-parser

A PHP parser written in PHP

17.4k954.1M2.5k](/packages/nikic-php-parser)[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k959.8M160](/packages/doctrine-lexer)[masterminds/html5

An HTML5 parser and serializer.

1.8k269.7M322](/packages/masterminds-html5)[erusev/parsedown

Parser for Markdown.

15.1k156.8M868](/packages/erusev-parsedown)[matomo/device-detector

The Universal Device Detection library, that parses User Agents and detects devices (desktop, tablet, mobile, tv, cars, console, etc.), clients (browsers, media players, mobile apps, feed readers, libraries, etc), operating systems, devices, brands and models.

3.5k26.4M182](/packages/matomo-device-detector)[pietercolpaert/hardf

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

38165.0k12](/packages/pietercolpaert-hardf)

PHPackages © 2026

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