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(6mo ago)019MITPHPPHP &gt;=8.0CI passing

Since May 3Pushed 6mo 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 1mo ago

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

34

—

LowBetter than 77% of packages

Maintenance66

Regular maintenance activity

Popularity6

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

202d 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.4k902.6M1.8k](/packages/nikic-php-parser)[doctrine/lexer

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

11.2k910.8M118](/packages/doctrine-lexer)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[erusev/parsedown

Parser for Markdown.

15.0k151.8M732](/packages/erusev-parsedown)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k404.0M702](/packages/league-commonmark)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)

PHPackages © 2026

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