PHPackages                             openactive/dataset-site - 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. openactive/dataset-site

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

openactive/dataset-site
=======================

Library for rendering the OpenActive dataset site

v7.0.0(3y ago)0249.3k—7.9%3[2 issues](https://github.com/openactive/dataset-site-template-php/issues)[1 PRs](https://github.com/openactive/dataset-site-template-php/pulls)MITMustachePHP &gt;=5.5CI failing

Since Oct 30Pushed 1y ago8 watchersCompare

[ Source](https://github.com/openactive/dataset-site-template-php)[ Packagist](https://packagist.org/packages/openactive/dataset-site)[ RSS](/packages/openactive-dataset-site/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (12)Used By (0)

dataset-site-template-php
=========================

[](#dataset-site-template-php)

PHP Classes and resources supporting dataset site creation, to create something like [this example](https://opendata.fusion-lifestyle.com/OpenActive/) (or any of the other examples listed [here](http://status.openactive.io/)).

This package intends to simplify creation of [OpenActive Dataset Sites](https://developer.openactive.io/publishing-data/dataset-sites) using templates.

For comparison, see the [.NET](https://github.com/openactive/OpenActive.DatasetSite.NET/) and [Ruby](https://github.com/openactive/dataset-site-template-ruby) implementations.

Please find full documentation that covers creation of the accompanying GitHub issues board at .

Table Of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Usage](#usage)
    - [API](#api)
        - [`renderSimpleDatasetSite($settings, $supportedFeedTypes, $staticAssetsPathUrl = null)`](#rendersimpledatasetsitesettings-supportedfeedtypes-staticassetspathurl--null)
        - [`renderSimpleDatasetSiteFromDataDownloads($settings, $dataDownloads, $dataFeedDescriptions, $staticAssetsPathUrl = null)`](#rendersimpledatasetsitefromdatadownloadssettings-datadownloads-datafeeddescriptions-staticassetspathurl--null)
        - [`renderDatasetSite($dataset, $staticAssetsPathUrl = null)`](#renderdatasetsitedataset-staticassetspathurl--null)
        - [`FeedType`](#feedtype)
- [Contribution](#contribution)
    - [Installation](#installation)
    - [Example](#example)
    - [Running Tests](#running-tests)
    - [Release](#release)

Requirements
------------

[](#requirements)

This project requires PHP &gt;=5.6. While most of the functionality should work down to PHP 5.4, some functionality (especially around parsing of offset for DateTimeZone) will not work with that version of PHP (see the [DateTimeZone PHP docs](https://www.php.net/manual/en/datetimezone.construct.php#refsect1-datetimezone.construct-changelog) for more info).

[Composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos) is also required for dependency management.

This project also makes use of [Mustache](https://github.com/bobthecow/mustache.php) for rendering the template (installed via Composer).

Usage
-----

[](#usage)

**Please Note:** This instruction are temporary and based on the current development status.

If you are developing this package, go to the [Contribution](#contribution) section.

To install from terminal, run:

```
composer require openactive/dataset-site
```

Wherever you want to render your Dataset page, include the following instructions:

```
use OpenActive\DatasetSiteTemplate\TemplateRenderer;

// Render compiled template with data
echo (new TemplateRenderer())->renderSimpleDatasetSite($settings, $supportedFeedTypes);
```

Or to render a [CSP-compatible template](https://developer.openactive.io/publishing-data/dataset-sites#template-hosting-options), first ensure that you are serving the [CSP compatible static assets](/src/datasetsite-csp.static.zip) from this version of the PHP package at a URL, and then include the following:

```
use OpenActive\DatasetSiteTemplate\TemplateRenderer;

// Render compiled template with data
echo (new TemplateRenderer())->renderSimpleDatasetSite($settings, $supportedFeedTypes, $staticAssetsPathUrl);
```

Where `$settings` could be defined like the following (as an example):

```
$settings = array(
    "openDataFeedBaseUrl" => "https://customer.example.com/feed/",
    "datasetSiteUrl" => "https://halo-odi.legendonlineservices.co.uk/openactive/",
    "datasetDiscussionUrl" => "https://github.com/gll-better/opendata",
    "datasetDocumentationUrl" => "https://docs.acmebooker.example.com/",
    "datasetLanguages" => array("en-GB"),
    "organisationName" => "Better",
    "organisationUrl" => "https://www.better.org.uk/",
    "organisationLegalEntity" => "GLL",
    "organisationPlainTextDescription" => "Established in 1993, GLL is the largest UK-based charitable social enterprise delivering leisure, health and community services. Under the consumer facing brand Better, we operate 258 public Sports and Leisure facilities, 88 libraries, 10 children’s centres and 5 adventure playgrounds in partnership with 50 local councils, public agencies and sporting organisations. Better leisure facilities enjoy 46 million visitors a year and have more than 650,000 members.",
    "organisationLogoUrl" => "http://data.better.org.uk/images/logo.png",
    "organisationEmail" => "info@better.org.uk",
    "platformName" => "AcmeBooker",
    "platformUrl" => "https://acmebooker.example.com/",
    "platformSoftwareVersion" => "2.0",
    "backgroundImageUrl" => "https://data.better.org.uk/images/bg.jpg",
    "dateFirstPublished" => "2019-10-28",
    "openBookingAPIBaseUrl" => "https://reference-implementation.openactive.io/api/openbooking",
    "openBookingAPIAuthenticationAuthorityUrl" => "https://auth.reference-implementation.openactive.io",
    "openBookingAPIDocumentationUrl" => "https://permalink.openactive.io/dataset-site/open-booking-api-documentation",
    "openBookingAPITermsOfServiceUrl" => "https://example.com/api-terms-page",
    "openBookingAPIRegistrationUrl" => "https://example.com/api-landing-page",
    "testSuiteCertificateUrl" => "https://certificates.reference-implementation.openactive.io/examples/all-features/controlled/",
);
```

And `$supportedFeedTypes` could be defined as:

```
use OpenActive\DatasetSiteTemplate\FeedType;

$supportedFeedTypes = array(
    FeedType::FACILITY_USE,
    FeedType::SCHEDULED_SESSION,
    FeedType::SESSION_SERIES,
    FeedType::SLOT,
);
```

And `$staticAssetsPathUrl` (if required) should be set to the URL path of the directory containing the CSP static asset files (contents of the [CSP compatible static assets archive](/src/datasetsite-csp.static.zip), using the assets archive in this version of the PHP package).

### API

[](#api)

#### `renderSimpleDatasetSite($settings, $supportedFeedTypes, $staticAssetsPathUrl = null)`

[](#rendersimpledatasetsitesettings-supportedfeedtypes-staticassetspathurl--null)

Returns a string corresponding to the compiled HTML, based on the `datasetsite.mustache`, the provided `$settings`, and `$supportedFeedTypes`.

If `$staticAssetsPathUrl` is provided, the [CSP-compatible template](https://developer.openactive.io/publishing-data/dataset-sites#template-hosting-options) is rendered. In this case you must ensure that you are serving the contents of the [CSP compatible static assets archive](/src/datasetsite-csp.static.zip) at this location, using the assets archive in this version of the PHP package.

`$settings` must contain the following keys:

##### Settings

[](#settings)

KeyTypeDescription`openDataFeedBaseUrl``string`The the base URL for the open data feeds`datasetSiteUrl``string`The URL where this dataset site is displayed (the page's own URL)`datasetDiscussionUrl``string`The GitHub issues page for the dataset`datasetDocumentationUrl``string`Any documentation specific to the dataset. Defaults to  if not provided, which should be used if no system-specific documentation is available.`datasetLanguages``string[]`The languages available in the dataset, following the IETF BCP 47 standard. Defaults to `array("en-GB")`.`organisationName``string`The publishing organisation's name`organisationUrl``string`The publishing organisation's URL`organisationLegalEntity``string`The legal name of the publishing organisation of this dataset`organisationPlainTextDescription``string`A plain text description of this organisation`organisationLogoUrl``string`An image URL of the publishing organisation's logo, ideally in PNG format`organisationEmail``string`The contact email of the publishing organisation of this dataset`platformName``string`The software platform's name. Only set this if different from the publishing organisation, otherwise leave as null to exclude platform metadata.`platformUrl``string`The software platform's website`platformSoftwareVersion``string`The software platform's software version`backgroundImageUrl``string`The background image to show on the Dataset Site page`dateFirstPublished``string`The date the dataset was first published`openBookingAPIBaseUrl``string`The Base URI of this implementation of the Open Booking API`openBookingAPIAuthenticationAuthorityUrl``string`The location of the OpenID Provider that must be used to access the API`openBookingAPIDocumentationUrl``string`The URL of documentation related to how to use the Open Booking API. Defaults to  if not provided, which should be used if no system-specific documentation is available.`openBookingAPITermsOfServiceUrl``string`The URL of terms of service related to the use of this API`openBookingAPIRegistrationUrl``string`The URL of a web page that the Broker may use to obtain access to the API, e.g. via a web form`testSuiteCertificateUrl``string`The URL of the OpenActive Test Suite certificate for this booking systemAnd `$supportedFeedTypes` must be an `array` of `FeedType` constants, which auto-generates the metadata associated which each feed using best-practice values. See [available types](#feedtype)

#### `renderSimpleDatasetSiteFromDataDownloads($settings, $dataDownloads, $dataFeedDescriptions, $staticAssetsPathUrl = null)`

[](#rendersimpledatasetsitefromdatadownloadssettings-datadownloads-datafeeddescriptions-staticassetspathurl--null)

Returns a string corresponding to the compiled HTML, based on the `datasetsite.mustache`, the provided [`$settings`](#settings), `$dataDownloads` and `$dataFeedDescriptions`.

If `$staticAssetsPathUrl` is provided, the [CSP-compatible template](https://developer.openactive.io/publishing-data/dataset-sites#template-hosting-options) is rendered. In this case you must ensure that you are serving the contents of the [CSP compatible static assets archive](/src/datasetsite-csp.static.zip) at this location, using the assets archive in this version of the PHP package.

The `$dataDownloads` argument must be an `array` of `\OpenActive\Models\OA\DataDownload` objects, which each describe an available open data feed.

The `$dataFeedDescriptions` must be an array of strings that describe the dataset, e.g:

```
$dataFeedDescriptions = array(
    "Sessions",
    "Facilities"
);
```

#### `renderDatasetSite($dataset, $staticAssetsPathUrl = null)`

[](#renderdatasetsitedataset-staticassetspathurl--null)

Returns a string corresponding to the compiled HTML, based on the `datasetsite.mustache`, and the provided `$dataset`.

If `$staticAssetsPathUrl` is provided, the [CSP-compatible template](https://developer.openactive.io/publishing-data/dataset-sites#template-hosting-options) is rendered. In this case you must ensure that you are serving the contents of the [CSP compatible static assets archive](/src/datasetsite-csp.static.zip) at this location, using the assets archive in this version of the PHP package.

The `$dataset` argument must be an object of type `\OpenActive\Models\OA\Dataset`, and must contain the properties required to render the dataset site.

#### `FeedType`

[](#feedtype)

A class containing the supported distribution types:

ConstantValue`COURSE``Course``COURSE_INSTANCE``CourseInstance``EVENT``Event``EVENT_SERIES``EventSeries``FACILITY_USE``FacilityUse``HEADLINE_EVENT``HeadlineEvent``INDIVIDUAL_FACILITY_USE``IndividualFacilityUse``SCHEDULED_SESSION``ScheduledSession``SESSION_SERIES``SessionSeries``SLOT``Slot`You can use any of the above like this:

```
use OpenActive\DatasetSiteTemplate\FeedType;

echo FeedType::COURSE_INSTANCE;
```

Which will output:

```
CourseInstance

```

Contribution
------------

[](#contribution)

### Installation

[](#installation)

```
git clone https://github.com/openactive/dataset-site-template-php.git
cd dataset-site-template-php
composer install
```

### Example

[](#example)

To run the examples using PHP's built in server:

```
composer start
```

or

```
composer start-csp
```

Once running navigate to `localhost:8080` in your browser to view the templates populated with JSON-LD data.

The default mustache templates (`datasetsite.mustache` and `datasetsite-csp.mustache`) are included under the `src` folder.

In `index.php` you can find an example of the associative array that's going to get parsed by `TemplateRenderer`.

### Running Tests

[](#running-tests)

PHPUnit is used to run tests.

To run the whole suite:

```
composer test
```

If you want to run the whole suite in verbose mode:

```
composer test -- --verbose
```

You can also run a section of the suite by specifying the class's relative path on which you want to perform tests:

```
composer test -- --verbose tests/Unit/TemplateRendererTest.php
```

For additional information on the commands available for PHPUnit, consult [their documentation](https://phpunit.de/manual/4.8/en/installation.html)

### Release

[](#release)

Major version numbers of this library should match those of the `dataset-site-template` on which this library depends. Any updates to the dataset site template files or assets should always be a major version update in both libraries.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.8% 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 ~99 days

Recently: every ~202 days

Total

11

Last Release

1398d ago

Major Versions

v0.5.0 → v6.0.02022-07-15

v6.0.1 → v7.0.02022-07-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/430aecdf901dd8fd7d06120674647e43c7e6fad451dfefb0a5b8765ff859a2bb?d=identicon)[openactive](/maintainers/openactive)

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

![](https://www.gravatar.com/avatar/b1796c4d0fa8f3a4ea110a15d09ffc5b43ac3d47fdf93754b62d38d5e38d04d5?d=identicon)[dtemple-odi](/maintainers/dtemple-odi)

![](https://www.gravatar.com/avatar/c3bab13ad9a6e9a13a284c4437cdede6bbc24490b2ab7bda937e7aa5a58e7e43?d=identicon)[howard.askew](/maintainers/howard.askew)

![](https://www.gravatar.com/avatar/7bd28e416f71fbd46847e5395f6978687c4905c272bfabf42b45b10e856baf05?d=identicon)[hkir](/maintainers/hkir)

---

Top Contributors

[![thtg88](https://avatars.githubusercontent.com/u/16927402?v=4)](https://github.com/thtg88 "thtg88 (57 commits)")[![nickevansuk](https://avatars.githubusercontent.com/u/2616208?v=4)](https://github.com/nickevansuk "nickevansuk (20 commits)")[![henryaddison](https://avatars.githubusercontent.com/u/49613?v=4)](https://github.com/henryaddison "henryaddison (9 commits)")[![ylt](https://avatars.githubusercontent.com/u/705668?v=4)](https://github.com/ylt "ylt (8 commits)")[![openactive-bot](https://avatars.githubusercontent.com/u/20357321?v=4)](https://github.com/openactive-bot "openactive-bot (3 commits)")[![thill-odi](https://avatars.githubusercontent.com/u/49978820?v=4)](https://github.com/thill-odi "thill-odi (3 commits)")[![Reikyo](https://avatars.githubusercontent.com/u/10506329?v=4)](https://github.com/Reikyo "Reikyo (2 commits)")[![nathansalter](https://avatars.githubusercontent.com/u/998690?v=4)](https://github.com/nathansalter "nathansalter (1 commits)")[![drinkynet](https://avatars.githubusercontent.com/u/6780886?v=4)](https://github.com/drinkynet "drinkynet (1 commits)")

---

Tags

dataset-publicationimplementation-supportphppre-release

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/openactive-dataset-site/health.svg)

```
[![Health](https://phpackages.com/badges/openactive-dataset-site/health.svg)](https://phpackages.com/packages/openactive-dataset-site)
```

###  Alternatives

[laracasts/commander

Commands and domain events in Laravel

283368.2k8](/packages/laracasts-commander)[vaimo/composer-changelogs

Provide information about package changes based on changelog files that are bundled with releases; provide tools for generating documentation files from changelog sources

11150.5k10](/packages/vaimo-composer-changelogs)[dollar/generators

Laravel 4 Generators w/ Bootstrap 3

7723.2k](/packages/dollar-generators)

PHPackages © 2026

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