PHPackages                             alcamo/rdfa - 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. alcamo/rdfa

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

alcamo/rdfa
===========

Classes to store RDFa statements

0.12.23(2mo ago)0356—8.3%4Apache-2.0PHPPHP 7.3 - 8.0

Since Jun 30Pushed 2mo ago1 watchersCompare

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

READMEChangelogDependencies (14)Versions (51)Used By (4)

Usage example
=============

[](#usage-example)

```
use alcamo\rdfa\RdfaData;

$rdfaData = RdfaData::newFromIterable(
    [
        [ 'dc:title', 'Example data' ],
        [ 'dc:creator', 'Alice' ],
        [ 'dc:creator', 'Bob' ],
        [ 'dc:created', '2025-10-21T19:09+02:00' ]
    ]
);

/* $rdfaData['dc:title'] is an array because a subject may have
 * multiple titles. */

$titles = $rdfaData['dc:title'];

echo 'Title: ' . reset($titles) . "\n";

/* $rdfaData['dc:creator'] is an array for the same reason. */

echo 'Creators: ';

foreach ($rdfaData['dc:creator'] as $creator) {
    echo "$creator, ";
}

echo "\n";

/* $rdfaData['dc:created'] is a single DcCreated object because a
 * subject may have only one such property. */

echo "Created at: {$rdfaData['dc:created']}\n";

/* The format() method is applied to the DateTime object contained in
 * the DcCreated object. */

echo "Same in a different format: "
    . $rdfaData['dc:created']->format('r') . "\n";

```

This will output:

```
Title: Example data
Creators: Alice, Bob,
Created at: 2025-10-21T19:09:00+02:00
Same in a different format: Tue, 21 Oct 2025 19:09:00 +0200

```

Overview
========

[](#overview)

Literals
--------

[](#literals)

The classes that implement `LiteralInterface` represent the concept of [RDF Literals](https://www.w3.org/TR/2014/REC-rdf11-concepts-20140225/#section-Graph-Literal), i.e. data elements that may have a datataype and a language tag.

Nodes
-----

[](#nodes)

The `Node` class represents the concept of RDF nodes, i.e. URIs which may have RDFa data attached.

RDFa statements
---------------

[](#rdfa-statements)

This package manages [RDFa](https://www.w3.org/TR/rdfa-primer/)statements, providing an interface `StmtInterface` and three implementation approaches.

The data model assumes that each property has a canonical prefix, such as `dc` for  . Thus, the package can deduce that the properties in the above example are the Dublic Core properties *title*, *creator* and *created*, and it can create objects of class `DcTitle`, `DcCreator` and `DcCreated` for them. The latter class knows that its object is a timestamp and is able to output it in various formats.

All statement classes implement the interface `StmtInterface`.

- Classes like `DcTitle` provide one class for one property.
- The class `XhvMetaStmt` provides one class for all XHTML metadata properties.
- The class `SimpleStmt` can be used for any statement of any property.

A number of statement classes is provided, more classes can easily be added.

Some classes know that their object is of a particular data type, such as DateTime for `DcCreated`. A number of classes have an object which must be or can be an RDFa node, which can itself have RDFa data attached. The class `Node` is provided for the latter case.

This package focuses on the representation of RDFa statements themselves in PHP, in order to have a unique way to manage metadata wherever they come from or go to.

Other packages may do something useful with these data, for instance [alcamo-http](https://github.com/rv1971/alcamo-http)creates HTTP headers, and [alcamo-html-page](https://github.com/rv1971/alcamo-html-page) creates HTML page headers.

Auxiliary classes
-----------------

[](#auxiliary-classes)

The package also provides some classes needed in RDFa statements which are useful by themselves:

- `Lang` implements an [RFC4646](http://tools.ietf.org/html/rfc4646)language tag.
- `MediaType` implements an [RFC 2046](https://tools.ietf.org/html/rfc2046) media type.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance84

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~35 days

Recently: every ~2 days

Total

49

Last Release

75d ago

PHP version history (2 changes)0.1PHP 7.3 - 7.4

0.1.4PHP 7.3 - 8.0

### Community

Maintainers

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

---

Top Contributors

[![rv1971](https://avatars.githubusercontent.com/u/39520256?v=4)](https://github.com/rv1971 "rv1971 (103 commits)")

---

Tags

RDFrdfastatement

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[easyrdf/easyrdf

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

62231.5M42](/packages/easyrdf-easyrdf)[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)

PHPackages © 2026

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