Download the PHP package openactive/dataset-site without Composer

On this page you can find all versions of the php package openactive/dataset-site. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dataset-site

dataset-site-template-php

PHP Classes and resources supporting dataset site creation, to create something like this example (or any of the other examples listed here).

This package intends to simplify creation of OpenActive Dataset Sites using templates.

For comparison, see the .NET and Ruby implementations.

Please find full documentation that covers creation of the accompanying GitHub issues board at https://developer.openactive.io/publishing-data/dataset-sites.

Table Of Contents

Requirements

This project requires PHP >=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 for more info).

Composer is also required for dependency management.

This project also makes use of Mustache for rendering the template (installed via Composer).

Usage

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

If you are developing this package, go to the Contribution section.

To install from terminal, run:

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

Or to render a CSP-compatible template, first ensure that you are serving the CSP compatible static assets from this version of the PHP package at a URL, and then include the following:

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

And $supportedFeedTypes could be defined as:

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, using the assets archive in this version of the PHP package).

API

renderSimpleDatasetSite($settings, $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 is rendered. In this case you must ensure that you are serving the contents of the CSP compatible static assets archive at this location, using the assets archive in this version of the PHP package.

$settings must contain the following keys:

Settings
Key Type Description
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 https://permalink.openactive.io/dataset-site/open-data-documentation 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 https://permalink.openactive.io/dataset-site/open-booking-api-documentation 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 system

And $supportedFeedTypes must be an array of FeedType constants, which auto-generates the metadata associated which each feed using best-practice values. See available types

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

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

If $staticAssetsPathUrl is provided, the CSP-compatible template is rendered. In this case you must ensure that you are serving the contents of the CSP compatible static assets archive 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:

renderDatasetSite($dataset, $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 is rendered. In this case you must ensure that you are serving the contents of the CSP compatible static assets archive 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

A class containing the supported distribution types:

Constant Value
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:

Which will output:

Contribution

Installation

Example

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

or

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

PHPUnit is used to run tests.

To run the whole suite:

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

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

For additional information on the commands available for PHPUnit, consult their documentation

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.


All versions of dataset-site with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
mustache/mustache Version ^2.12
openactive/models Version ^1.0.0 | 0.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package openactive/dataset-site contains the following files

Loading the files please wait ....