PHPackages                             kwijibo/raffles - 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. [Database &amp; ORM](/categories/database)
4. /
5. kwijibo/raffles

ActiveLibrary[Database &amp; ORM](/categories/database)

kwijibo/raffles
===============

An embeddable RDF store supporting simple querying, searching, geo search and faceted browsing

223PHP

Since Nov 7Pushed 13y ago1 watchersCompare

[ Source](https://github.com/kwijibo/Raffles)[ Packagist](https://packagist.org/packages/kwijibo/raffles)[ RSS](/packages/kwijibo-raffles/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Raffles is a simple file-based RDF/Graph datastore written in PHP. It is written as a way to dynamically publish small datasets easily on PHP web hosting without using an external database.

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

[](#installation)

composer create-project kwijibo/raffles raffles

see [Composer](http://getcomposer.org)

Creating a Store and Importing Data
-----------------------------------

[](#creating-a-store-and-importing-data)

```
    require 'Raffles/lib/rafflesstore.php';
    require_once 'Raffles/vendor/autoload.php';

    $data_dir = __DIR__ . '/data';
    $store = new RafflesStore($data_dir);
    $store->indexPredicates = array(
        'http://www.w3.org/1999/02/22-rdf-syntax-ns#type',
        'http://purl.org/dc/terms/creator',
        'http://purl.org/dc/terms/date',
    );
    // you can configure Raffles to only index specific predicates

    $store->addNamespacePrefix('library', 'http://purl.org/library/');
    // add prefixes you want to use in queries

```

### Getting types of things in the Store

[](#getting-types-of-things-in-the-store)

```
    $types = $store->getTypes();
    // array(
    // http://schema.org/Place => 321,
    // http://schema.org/Person => 456,
    //)

```

### Getting Facets

[](#getting-facets)

```
    $dates = $store->getFacets('http://purl.org/dc/terms/date');

    // array ( "1560" => 4, "1562" => 12, "1570" => 31  )

```

Basic Path query language
-------------------------

[](#basic-path-query-language)

`rdf:type=foaf:Person` (all things of type Person)

`foaf:made/dct:date=1780` (anyone who made something in 1780)

```
    $limit=20;
    $offset=0;
    $results = $store->query("foaf:made/dct:date=1560", $limit, $offset);

```

Results are returned as a PHP associative array following the [RDF JSON](https://github.com/iand/rdf-json) structure

```
    array (
    S => array(
        P => array (
          array(
              value => O,
              type => literal|uri|bnode
              [, lang=O_LANG ]
              [, datatype=O_DATATYPE ]
            )
        )
     )

```

Search
------

[](#search)

```
    $results = $store->search("Edinbu");

```

Running the tests
=================

[](#running-the-tests)

`php specs/run.php`

### License

[](#license)

This code is Public Domain. Use, copy, or change it freely, at your own risk.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/98d4088dad5fb2a68923b5a985449733421c9a839d339f30f5a6ea798afe8a11?d=identicon)[kwijibo](/maintainers/kwijibo)

---

Top Contributors

[![kwijibo](https://avatars.githubusercontent.com/u/78849?v=4)](https://github.com/kwijibo "kwijibo (26 commits)")

### Embed Badge

![Health badge](/badges/kwijibo-raffles/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M545](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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