PHPackages                             byjg/sparqllib - 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. [API Development](/categories/api)
4. /
5. byjg/sparqllib

ActiveLibrary[API Development](/categories/api)

byjg/sparqllib
==============

Simple library to query SPARQL from PHP

2.0.0(4y ago)451.1k12LGPL-3.0PHPCI failing

Since Apr 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/byjg/PHP-SPARQL-Lib)[ Packagist](https://packagist.org/packages/byjg/sparqllib)[ RSS](/packages/byjg-sparqllib/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (2)Versions (10)Used By (2)

PHP SPARQL Lib
==============

[](#php-sparql-lib)

[![Build Status](https://camo.githubusercontent.com/337630b27e541a70cafd32a3672d3eec4d998f76605c2237055c250f5c5b2bb7/68747470733a2f2f7472617669732d63692e636f6d2f62796a672f5048502d53504152514c2d4c69622e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/byjg/PHP-SPARQL-Lib)[![SensioLabsInsight](https://camo.githubusercontent.com/91e32fcd6f33126aed247071e2a67fa16e39e8972d4c6d61f1dd62e6f74b8bf4/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f34316431366330622d666464362d346330302d386234362d3931393762393438393635392f6d696e692e706e67)](https://insight.sensiolabs.com/projects/41d16c0b-fdd6-4c00-8b46-9197b9489659)

Copyright 2010,2011,2012 Christopher Gutteridge &amp; University of Southampton Licensed as LGPL

Info
----

[](#info)

- Forked code by Joao Gilberto Magalhaes.
- Refactored code to support PHP 5.x namespaces, composer, autoload classes and unit tests;
- Full documentation:

Example:
--------

[](#example)

```
$db = new \SparQL\Connection( "http://rdf.ecs.soton.ac.uk/sparql/" );
$db->ns( "foaf","http://xmlns.com/foaf/0.1/" );

$sparql = "SELECT * WHERE { ?person a foaf:Person . ?person foaf:name ?name } LIMIT 5";
$result = $db->query( $sparql );

$fields = $result->fieldArray();

print "Number of rows: " . $result->numRows() . " results.";
print "";
print "";
foreach( $fields as $field )
{
   print "$field";
}
```

Simplified call
---------------

[](#simplified-call)

```
$results = new \SparQL\Connection::get( "http://rdf.ecs.soton.ac.uk/sparql/" )
            ->withNamespace( "foaf","http://xmlns.com/foaf/0.1/" )
            ->fetch("SELECT * WHERE { ?person a foaf:Person . ?person foaf:name ?name } LIMIT 5");

foreach ($results as $item) {
    print "" . $item["person"]
}
```

Run tests
---------

[](#run-tests)

Just type:

```
phpunit

```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 73.4% 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 ~299 days

Recently: every ~492 days

Total

9

Last Release

1699d ago

Major Versions

1.0.7 → 2.0.02021-10-31

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/981924?v=4)[Joao Gilberto Magalhaes](/maintainers/byjg)[@byjg](https://github.com/byjg)

---

Top Contributors

[![byjg](https://avatars.githubusercontent.com/u/981924?v=4)](https://github.com/byjg "byjg (47 commits)")[![cgutteridge](https://avatars.githubusercontent.com/u/510699?v=4)](https://github.com/cgutteridge "cgutteridge (16 commits)")[![alexbilbie](https://avatars.githubusercontent.com/u/77991?v=4)](https://github.com/alexbilbie "alexbilbie (1 commits)")

---

Tags

hacktoberfestphpphp7sparql-client

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/byjg-sparqllib/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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