PHP code example of czproject / plsgenerator

1. Go to this page and download the library: Download czproject/plsgenerator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

czproject / plsgenerator example snippets

 php

$playlist = new Cz\PlsGenerator;

// add track (only $filename is e)
echo $playlist; // or echo $playlist->generate();

// or save playlist into file
$playlist->save('playlist.pls');
 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;