PHPackages                             alcamo/rdf-literal - 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/rdf-literal

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

alcamo/rdf-literal
==================

RDF literals

0.1.10(1w ago)040—0%1Apache-2.0PHPPHP 7.3 - 8.0

Since Apr 17Pushed 4d agoCompare

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

READMEChangelogDependencies (8)Versions (12)Used By (1)

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

[](#usage-example)

```
use alcamo\rdf_literal\LiteralFactory;

include $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php';

$factory = new LiteralFactory();

$number = $factory->create(1970);

echo $number . PHP_EOL;

echo $number->getDatatypeUri() . PHP_EOL;

$year = $factory->create(1970, LiteralFactory::XSD_NS . 'gYear');

echo $year . PHP_EOL;

echo $year->getDatatypeUri() . PHP_EOL;

echo "Literals are "
    . ($year->equals($number) ? '' : 'not')
    . ' equal' . PHP_EOL;

```

This example is contained in this package as a file in the `bin`directory. It will output

```
1970
http://www.w3.org/2001/XMLSchema#integer
1970
http://www.w3.org/2001/XMLSchema#gYear
Literals are not equal

```

Overview
========

[](#overview)

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 have a datataype and may have a language tag.

Among others, this allows to:

- Create values of various types from strings, governed by an XSD datatype URI.
- Add a \_\_toString() function to values which are not stringable.
- Add a custom \_\_toString() function which differs from the default representation of a value.
- Distinguish values that may be represented the same way in PHP but have different meanings.

See the doxygen documentation for details.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance99

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

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

Total

11

Last Release

12d ago

### 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 (14 commits)")

---

Tags

RDFdatatypeliteral

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[easyrdf/easyrdf

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

61631.9M43](/packages/easyrdf-easyrdf)[semsol/arc2

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

332258.6k16](/packages/semsol-arc2)[sweetrdf/easyrdf

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

261.4M12](/packages/sweetrdf-easyrdf)[professional-wiki/wikibase-rdf

Wikibase extension that allows defining RDF mappings for Wikibase Entities

169.3k](/packages/professional-wiki-wikibase-rdf)[professional-wiki/wikibase-local-media

Adds the local media data type to Wikibase

128.1k](/packages/professional-wiki-wikibase-local-media)

PHPackages © 2026

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