承接 krakero/podcastfeed 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

krakero/podcastfeed

最新稳定版本:v1.0

Composer 安装命令:

composer require krakero/podcastfeed

包简介

Generate RSS feeds for podcasts in Laravel

README 文档

README

NOTE: This package was forked from the existing packge by Torann.

Podcast Generator for Laravel

Generate a RSS feed for podcast for Laravel.

Installation

From the command line run

composer require krakero/podcastfeed

Setup

Once installed you need to register the service provider with the application. Open up config/app.php and find the providers key.

'providers' => [
    ...

    Krakero\PodcastFeed\PodcastFeedServiceProvider::class,

    ...
]

This package also comes with a facade, which provides an easy way to call the the class. Open up config/app.php and find the aliases key

'aliases' => [
    ...

    'PodcastFeed' => Krakero\PodcastFeed\Facades\PodcastFeed::class,

    ...
];

Publish the configurations

Run this on the command line from the root of your project:

$ php artisan vendor:publish --provider="Krakero\PodcastFeed\PodcastFeedServiceProvider"

A configuration file will be publish to config/podcast-feed.php.

Methods

setHeader The header of the feed can be set in the config file or manually using the setHeader method:

PodcastFeed::setHeader([
    'title'       => 'All About Everything',
    'subtitle'    => 'A show about everything',
    'description' => 'Great site description',
    'link'        => 'http://www.example.com/podcasts/everything/index.html',
    'image'       => 'http://example.com/podcasts/everything/AllAboutEverything.jpg',
    'author'      => 'John Doe',
    'email'       => 'john.doe@example.com',
    'category'    => 'Technology',
    'language'    => 'en-us',
    'copyright'   => '2016 John Doe & Family',
]);

addMedia Adding media to the feed.

foreach($this->podcastRepository->getPublished() as $podcast)
{
    PodcastFeed::addMedia([
        'title'       => $podcast->title,
        'description' => $podcast->title,
        'publish_at'  => $podcast->publish_at,
        'guid'        => route('podcast.show', $podcast->slug),
        'url'         => $podcast->media->url(),
        'type'        => $podcast->media_content_type,
        'duration'    => $podcast->duration,
        'image'       => $podcast->image->url(),
    ]);
}

toString Converting feed to a presentable string. The example below was pulled from a controller. In theory you could implement a caching method so that it doesn't have to render each time.

public function index()
{
    foreach($this->podcastRepository->getPublished() as $podcast) {
        PodcastFeed::addMedia([
            'title'       => $podcast->title,
            'description' => $podcast->title,
            'publish_at'  => $podcast->publish_at,
            'guid'        => route('podcast.show', $podcast->slug),
            'url'         => $podcast->media->url(),
            'type'        => $podcast->media_content_type,
            'duration'    => $podcast->duration,
            'image'       => $podcast->image->url(),
        ]);
    }

    return Response::make(PodcastFeed::toString())
        ->header('Content-Type', 'text/xml');
}

Change Log

v0.2.1

  • Fixes foreign characters like 'æ', 'ø' and 'å'

v0.2.0

  • Support Laravel 5

v0.1.0

  • First release

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 26
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2024-03-12