ffraenz / plurio-net-php
此软件包已被 废弃 并不再维护。未建议替代软件包。
PHP 库简化了对卢森堡及其周边地区文化事件数据库的访问
v0.0.1
2018-04-14 20:12 UTC
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2019-09-13 08:33:06 UTC
README
此 PHP 库旨在简化访问卢森堡及其周边地区文化事件数据库 Plurio.net 的 XML 接口。
功能
- 从 Plurio.net XML 接口获取事件
- 使用 XML 架构验证数据
- 根据日期范围、日期排除、时间安排和时间异常计算事件发生和日程安排
- 将日期和时间替换为配置了正确时区的
DateTime
对象 - 从不同来源注入类别和功能数据
- 提供简单接口和一致数据
示例
使用 composer 将此库作为依赖项安装。
$ composer require ffraenz/plurio-net-php
要创建 Export
实例,您需要提供获取 XML 数据的导出 URL。要获取对 XML 接口的访问权限,请联系 Plurio.net。
$exportUrl = 'PLURIO_NET_EXPORT_URL_HERE'; $export = new FFraenz\PlurioNet\Export($exportUrl); $events = $export->getEvents();
结果 PHP 数组 $events
的结构类似于以下数据。请注意,以下数据已缩短且 ID 已转换为大写字母。
[ "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" ] ] ];