essfeed / event-feed
创建XML ESS Feeds并向搜索引擎广播事件信息以提高SEO
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-28 14:58:03 UTC
README
https://github.com/essfeed/php-ess
ESS:事件标准同步。ESS是专为事件设计的免费开源XML feed。此库允许通过简单的实例化生成ESS feed并将事件feed广播到搜索引擎。
要使用此类,/samples/complex_events.php 中提供了完整示例
- 简单固定日期。
- 递归日期(每月几次,连续六个月的最后一个星期六...)
- 免费事件或带有支付(带有支付API URL)的事件。
- 仅限邀请的事件。
- 用图片、视频和声音描述事件。...
用法
/************************************************************************************************ * * This complete exemple create an event feed that describe: * * - A 2 hours Madonna concert that happend every years for three years at 9:30PM the 25th of Oct. * - It happends in a stadium in New York. * - This happening is defined with a category "concert" explained as "Rock music" * - Several specific TAGs are attached to improve SEO. * - The price is defined to $90 (with a URL for payment). * - The event can be free with a specific card accreditation. * - An image and a video is defined to give a face to the event. * ************************************************************************************************/ include("FeedWriter.php"); $feed_url = 'http://your_website.com/feeds/event-feed-123.ess'; $event_page = 'http://your_website.com/events/event-page-123.html'; // == Create the ESS Feed ================ $essFeed = new FeedWriter( 'en', array( 'title' => 'Madonna events feed', 'link' => $feed_url, 'published' => '2013-10-25T15:30:00-08:00', 'rights' => 'Madonna Copyright (c)' )); // == Create an Event ===================== $newEvent = $essFeed->newEventFeed( array( 'title' => 'Madonna Concert', 'uri' => $event_page, 'published' => 'now', 'access' => 'PUBLIC', 'description' => "This is the description of the Madonna concert.", 'tags' => array( 'music', 'pop', '80s', 'Madonna', 'concert' ) )); // -- Define event's category(s) -------------------------------- $newEvent->addCategory( 'concert', array( 'name' => 'Rock Music' )); // -- Define event's date(s) ------------------------------------ $newEvent->addDate('recurrent', 'year', 3, null,null,null,array( 'name' => 'Yearly concert', 'start' => '2013-10-25T21:30:00Z', 'duration' => '7200' )); // -- Define event's place(s) ----------------------------------- $newEvent->addPlace( 'fixed', null,array( 'name' => 'Stadium', 'latitude' => '40.71675', 'longitude' => '-74.00674', 'address' => 'Ave of Americas, 871', 'city' => 'New York', 'zip' => '10001', 'state' => 'New York', 'state_code' => 'NY', 'country' => 'United States of America', 'country_code' => 'US' )); // -- Define event's price(s) ------------------------------------------------------------ $newEvent->addPrice('standalone','free',null,null,null,null,null,array('name'=>'ClubCard')); $newEvent->addPrice('standalone','fixed',null,null,null,null,null,array( 'name' => 'Normal entrance', 'value' => '90', 'currency' => 'USD', 'uri' => 'http://madonna.com/payment/api' )); // -- Define event's social platform and people involved ------------------------------- $newEvent->addPeople('performer',array('name'=>'Madonna' ) ); $newEvent->addPeople('attendee',array('name'=>'Conditions','maxpeople'=>5000)); $newEvent->addPeople('social',array('name'=>'Madona','uri'=>'http://facebook.com/madonna')); // -- Define event's media files (images, sounds, videos, websites) ------------------- $newEvent->addMedia('image',array('name'=>'Photo 01','uri'=>'http://madonna.com/i.png')); $newEvent->addMedia('video',array('name'=>'Video 02','uri'=>'http://madonna.com/v.ogg')); // == Add the event to the Feed $essFeed->addItem( $newEvent ); // == Other events can be created and added to the feed here... // ... // == Display the ESS Feed generated. $essFeed->genarateFeed();
ESS XML结果将作为搜索引擎和机器人爬虫显示
https://github.com/essfeed/php-ess/blob/master/samples/simple_event.ess
PHP Composer
此PHP库在Composer中可用,适用于Packagist 仓库中的 Symphony 程序员。要安装PHP ESS Feed库,只需在您的"composer.json"文件中添加以下行
{
"require": {
...
"essfeed/event-feed": "dev-master"
}
}
RSS和ESS之间的差异
到目前为止,活动推广者只能使用RSS或iCalendar来广播他们的活动。问题是关键信息在活动描述中丢失。现在,随着ESS,所有事件的标准都得到了明确定义。
贡献
欢迎对项目的贡献。请随意分支并改进。我们接受拉取请求和问题,特别是当包含测试时。
许可
(MIT许可)
版权(c)2013
在此特此授予任何人获得此软件及其相关文档文件(“软件”)副本(“软件”)的许可,免费且不受限制地处理该软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本,并允许向软件提供副本的个人这样做,前提是满足以下条件
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、适用于特定目的和不侵犯版权的保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论是否基于合同、侵权或其他原因,无论源于、因之或与此软件或软件的使用或其他交易有关。