定制 sokolnikov911/yandex-turbo-pages 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sokolnikov911/yandex-turbo-pages

最新稳定版本:v1.1.2

Composer 安装命令:

composer require sokolnikov911/yandex-turbo-pages

包简介

PHP7 Yandex Turbo Pages RSS feed generator

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version composer.lock PHPPackages Rank PHPPackages Referenced By StandWithUkraine
Travis CI Build Status
Scrutinizer CI Build Status Scrutinizer Code Quality Code Coverage

Russian version of README you can find here: README_RU.md.

Yandex Turbo Pages valid RSS feed generator for PHP 7+. In this version type hinting used, so you need at least PHP 7.0.

Version for PHP 5.4 you can find here.

Examples

This example you can find in examples/example.php

// creates Feed with all needed namespaces
$feed = new Feed();

// creates Channel with description and one ad from Yandex Ad Network
$channel = new Channel();
$channel
    ->title('Channel Title')
    ->link('http://blog.example.com')
    ->description('Channel Description')
    ->language('ru')
    ->adNetwork(Channel::AD_TYPE_YANDEX, 'RA-123456-7', 'first_ad_place')
    ->appendTo($feed);

// adds Google Analytics to feed
$googleCounter = new Counter(Counter::TYPE_GOOGLE_ANALYTICS, 'XX-1234567-89');
$googleCounter->appendTo($channel);

// adds Yandex Metrika to feed
$yandexCounter = new Counter(Counter::TYPE_YANDEX, 12345678);
$yandexCounter->appendTo($channel);

// creates first page of feed with link and enabled turbo, description and other content, and appends this page to channel
$item = new Item();
$item
    ->title('Thirst page!')
    ->link('http://www.example.com/page1.html')
    ->author('John Smith')
    ->category('Technology')
    ->turboContent('Some content here!<br>Second content string.')
    ->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
    ->appendTo($channel);

// creates list of related pages
$relatedItemsList = new RelatedItemsList();

// adds link to first related page
$relatedItem = new RelatedItem('Related article 1', 'http://www.example.com/related1.html');
$relatedItem->appendTo($relatedItemsList);

// adds link to second related page with image
$relatedItem = new RelatedItem('Related article 2', 'http://www.example.com/related2.html',
    'http://www.example.com/related2.jpg');
$relatedItem->appendTo($relatedItemsList);

// appends list of related links to first page
$relatedItemsList
    ->appendTo($item);

// creates another one page with disabled turbo
$item = new Item(false);
$item
    ->title('Second page!')
    ->link('http://www.example.com/page2.html')
    ->author('John Smith')
    ->category('Technology')
    ->turboContent('Yet another content here!')
    ->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
    ->appendTo($channel);

// displays the generated feed
echo $feed;

For generating content for turbo items you can use Content helper. For example:

// generate header
$menuArray = [
    ['url' => 'http://example/page1.html', 'title' => 'Page title 1'],
    ['url' => 'http://example/page2.html', 'title' => 'Page title 2']
];
$header = Content::header('Main title', 'Second title',
    'http://example.com/image1.jpg', 'Image description', $menuArray);

At this time you can use helpers for generate next elements:

  • page header including menu;
  • image;
  • images gallery;
  • share buttons;
  • link or phone button;
  • comments;
  • rating;
  • accordion;
  • video from own server;
  • video from external server;
  • ad block position element;
  • media-content with slider;
  • additional content block;
  • search input;
  • modal contact form;
  • inline contact form.

Examples of using helpers you can find in examples/content_helpers.php.

Installing

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version of yandex-turbo-pages

php composer.phar require sokolnikov911/yandex-turbo-pages

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

You can then later update yandex-turbo-pages using composer:

composer.phar update

Requirements

This Yandex Trurbo Pages RSS feed generator requires at least PHP 7.0 (yeahh, type hinting!).

License

License

This library is licensed under the MIT License.

统计信息

  • 总下载量: 85.17k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 49
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 46
  • Watchers: 11
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-25