ffraenz/plurio-net-php

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP library simplifying access to the database of cultural events in Luxembourg and the greater region

v0.0.1 2018-04-14 20:12 UTC

This package is auto-updated.

Last update: 2019-09-13 08:33:06 UTC


README

Packagist version MIT license

This PHP library tries to simplify access to the XML interface of Plurio.net, the database of cultural events in Luxembourg and the greater region.

Features

  • Fetches events from the Plurio.net XML interface
  • Verifies data with XML schemas
  • Calculates event occurrences and schedules from date ranges, date exclusions, timings and timing exceptions
  • Replaces dates and times with DateTime objects configured with the correct timezone
  • Injects category and function data from different sources
  • Provides a simple interface and consistent data

Example

Use composer to install this library as a dependency.

$ composer require ffraenz/plurio-net-php

To create an Export instance, you need to provide an export url where the XML data gets fetched from. To get access to the XML interface, contact Plurio.net.

$exportUrl = 'PLURIO_NET_EXPORT_URL_HERE';
$export = new FFraenz\PlurioNet\Export($exportUrl);
$events = $export->getEvents();

The resulting PHP array $events is structured similarly to the following data. Note, that the data below is shortened and ids are leetified.

[
    "id" => 1337,
    "name" => "Spaghettisfest 2018",
    "subtitles" => [
        "Since 1985 in Eppeldorf"
    ],
    "description" => [
        "lu" => "S\u00e4it iwwer 30 Joer versammelen sech...",
        "en" => "For over 30 years hungry people gather..."
    ],
    "location" => [
        "id" => 1337,
        "name" => "Pompjeesbau Eppelduerf",
        "street" => "Faubourg 14",
        "postcode" => "L-9365",
        "locality" => "Eppeldorf",
        "localityId" => "L1337"
    ],
    "contacts" => [
        [
            "type" => "url",
            "value" => "http://spaghettisfest.lu"
        ],
        [
            "type" => "emailAddress",
            "value" => "contact@eppelduerferjugend.lu",
            "function" => [
                "id" => "1337",
                "description" => [
                    "de" => "Kontakt",
                    "fr" => "Contact"
                ]
            ]
        ],
        [
            "type" => "phoneNumber",
            "subtype" => "mobile",
            "value" => "00352123456789",
            "function" => [
                "id" => "1337",
                "description" => [
                    "de" => "Kontakt",
                    "fr" => "Contact"
                ]
            ]
        ]
    ],
    "occurrences" => [
        [
            "allDay" => false,
            "time" => new DateTime("2018-08-15 12:00:00"),
            "endTime" => new DateTime("2018-08-16 03:00:00"),
            "schedule" => [
                [
                    "time" => new DateTime("2018-08-15 12:00:00"),
                    "endTime" => new DateTime("2018-08-15 14:00:00"),
                    "description" => "Spaghetti & Bar"
                ],
                [
                    "time" => new DateTime("2018-08-15 18:00:00"),
                    "endTime" => new DateTime("2018-08-15 22:00:00"),
                    "description" => "Spaghetti & Bar"
                ],
                [
                    "time" => new DateTime("2018-08-15 22:00:00"),
                    "endTime" => new DateTime("2018-08-16 03:00:00"),
                    "description" => "Bar"
                ]
            ]
        ]
    ],
    "pricing" => [
        [
            "value" => 12,
            "description" => "Spaghetti All-You-Can-Eat"
        ],
        [
            "value" => 9,
            "description" => "Spaghetti Small"
        ]
    ],
    "categories" => [
        [
            "id" => 1337,
            "name" => [
                "de" => "Gastronomie",
                "en" => "Gastronomy",
                "fr" => "Gastronomie"
            ],
            "parentName" => [
                "de" => "Freizeit",
                "en" => "Leisure",
                "fr" => "Loisirs"
            ]
        ]
    ],
    "organisations" => [
        [
            "id" => "1337",
            "name" => "Eppelduerfer Jugend",
            "function" => [
                "id" => "1337",
                "description" => [
                    "de" => "Organisation",
                    "fr" => "Organisation"
                ]
            ]
        ]
    ],
    "images" => [
        [
            "id" => 1337,
            "url" => "http://example.com/image.png",
            "title" => "Image title",
            "alt" => "Image alt",
            "position" => "default"
        ]
    ]
];