czproject/plsgenerator

PHP class for generating of PLS playlist files.

v1.0.1 2018-06-24 11:48 UTC

This package is auto-updated.

Last update: 2024-10-14 08:00:11 UTC


README

PHP class for generating of PLS playlist files.

Become a Patron! Buy me a coffee

Installation

Download a latest package or use Composer:

composer require czproject/plsgenerator

PlsGenerator requires PHP 5.3.0 or later.

Usage

<?php
$playlist = new Cz\PlsGenerator;

// add track (only $filename is required paramater)
$playlist->addTrack($filename, $title, $length);

// generate (print to page)
echo $playlist; // or echo $playlist->generate();

// or save playlist into file
$playlist->save('playlist.pls');

Dynamic online playlist

<?php
header('Content-type: ' . Cz\PlsGenerator::MIME_TYPE);
header('Content-Disposition: attachment; filename="music.pls"');

$playlist = new Cz\PlsGenerator;

// add tracks
$playlist->addTrack('track1.mp3', 'Oasis - The Masterplan');
$playlist->addTrack('track2.mp3', 'The Cranberries - Zombie');

// send to browser
echo $playlist;

License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/