Giter Site home page Giter Site logo

podcastfeed's Introduction

Podcast Generator for Laravel

Generate a RSS feed for podcast for Laravel 5.

Installation

From the command line run

$ composer require torann/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' => [
    ...

    Torann\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' => Torann\PodcastFeed\Facades\PodcastFeed::class,

    ...
];

Publish the configurations

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

$ php artisan vendor:publish --provider="Torann\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'       => '[email protected]',
    '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

podcastfeed's People

Contributors

torann avatar ariselseng avatar calebporzio avatar

Stargazers

LogikIO avatar Samuel Nitsche avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.