1. Go to this page and download the library: Download openactive/models library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
openactive / models example snippets
// Make sure you use the right namespace for your models
use OpenActive\Models\OA\SessionSeries;
use OpenActive\Models\OA\Place;
use OpenActive\Models\OA\GeoCoordinates;
use OpenActive\Models\OA\Concept;
use OpenActive\Models\OA\Organization;
use OpenActive\Models\OA\Offer;
$sessionSeries = new SessionSeries([
"name" => "Virtual BODYPUMP",
"description" => "This is the virtual version of the original barbell class, which will help you get lean, toned and fit - fast",
"startDate" => "2017-04-24T19:30:00-08:00",
"endDate" => "2017-04-24T23:00:00-08:00",
"location" => new Place([
"name" => "Raynes Park High School, 46A West Barnes Lane",
"geo" => new GeoCoordinates([
"latitude" => 51.4034423828125,
"longitude" => -0.2369088977575302,
])
]),
"activity" => [new Concept([
"id" => "https://openactive.io/activity-list#5e78bcbe-36db-425a-9064-bf96d09cc351",
"prefLabel" => "Bodypump™",
"inScheme" => "https://openactive.io/activity-list"
])],
"organizer" => new Organization([
"name" => "Central Speedball Association",
"url" => "http://www.speedball-world.com"
]),
"offers" => [new Offer([
"identifier" => "OX-AD",
"name" => "Adult",
"price" => 3.3,
"priceCurrency" => "GBP",
"url" => "https://profile.everyoneactive.com/booking?Site=0140&Activities=1402CBP20150217&Culture=en-GB"
])],
]);
use OpenActive\Models\OA\Schedule;
use OpenActive\Enums\SchemaOrg\DayOfWeek;
new Schedule([
"scheduledEventType" => "Event",
"startTime" => "12:00:00",
"endTime" => "14:00:00",
"byDay" => [
new DayOfWeek\Monday,
new DayOfWeek\Wednesday,
new DayOfWeek\Friday
],
...
]);
use OpenActive\Models\OA\SessionSeries;
echo SessionSeries::serialize($sessionSeries, true);