PHPackages                             alcamo/rdf-literal-workbench - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. alcamo/rdf-literal-workbench

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

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

RDF literal creation and validation

0.2.0(2w ago)021↓80%2Apache-2.0PHPPHP 7.3 - 8.5

Since Jul 8Pushed 1mo agoCompare

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

READMEChangelogDependencies (6)Versions (5)Used By (2)

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

[](#usage-example)

```
namespace alcamo\rdf_literal_workbench;

use alcamo\rdf_literal\StringLiteral;
use alcamo\uri\FileUriFactory;

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

$factory = new LiteralFactory();

$factory->getSchema()->addUris(
    [
        (new FileUriFactory)->create(
            dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor'
                . DIRECTORY_SEPARATOR . 'alcamo'
                . DIRECTORY_SEPARATOR . 'dom'
                . DIRECTORY_SEPARATOR . 'xsd'
                . DIRECTORY_SEPARATOR . 'xhtml-datatypes-1.xsd'
        )
    ]
);

$ncNameType =
    $factory->getSchema()->getGlobalType(LiteralFactory::XH11D_NS . ' Pixels');

$literal1 = $factory->create(1024, $ncNameType);

echo "$literal1: class " . get_class($literal1) . PHP_EOL;

$typeMap = new LiteralTypeMap();

$typeMap->validateLiteral($literal1);

$literal2 = new StringLiteral('foo', LiteralFactory::XSD_NS . '#QName');

$typeMap->validateLiteral($literal2);

```

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

```
1024: class alcamo\rdf_literal\NonNegativeIntegerLiteral
PHP Fatal error:  Uncaught alcamo\exception\DataValidationFailed: Validation failed; literal datatype http://www.w3.org/2001/XMLSchema QName not derived from default datatype http://www.w3.org/2001/XMLSchema string in /home/rve/src/alcamo-rdf-literal-workbench/src/LiteralTypeMap.php:62

```

Unlike `alcamo\rdf_literal\LiteralFactory`, the class `alcamo\rdf_literal_workbench\LiteralFactory` contains an XML schema and hence is aware of the type hierarchy. Thus, the above call to `create()` creates an instance of `NonNegativeIntegerLiteral` since the factory knows that the simple type `xh11d:Pixels` is derived from `xsd:NonNegativeInteger`.

The class `alcamo\rdf_literal\LiteralTypeMap`, which contains an XML Schema as well, can be used to validate whether the datatype of a literal is actually supported by the literal class, i.e. derived from its defaut type. In the above example, $literal1 is valid while $literal2 is not. The literal classes themselves do not check this because they would need an XML schema for this.

See the doxygen documentation for details.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance94

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

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

Total

4

Last Release

17d 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 (4 commits)")

---

Tags

factoryRDFdatatypeliteral

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[toplan/laravel-sms

A mobile phone number validation solution based on laravel

83580.2k2](/packages/toplan-laravel-sms)[phpexperts/datatype-validator

An easy to use data type validator (both strict and fuzzy).

131.2M2](/packages/phpexperts-datatype-validator)[hyperf/validation

hyperf validation

122.2M213](/packages/hyperf-validation)[udokmeci/yii2-phone-validator

Modern Yii2 Phone validator wrapper on top of PhoneNumberUtil library also used by Android devices

36227.5k1](/packages/udokmeci-yii2-phone-validator)

PHPackages © 2026

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