PHP code example of ajvolin / xmltv

1. Go to this page and download the library: Download ajvolin/xmltv 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/ */

    

ajvolin / xmltv example snippets




use XmlTv\Tv;
use XmlTv\XmlTv;

annel('channel1');
$channel->addDisplayName(new Tv\Elements\DisplayName('Channel 1', 'en'));

$programme = new Tv\Programme('channel1', '20170914190000 +0200', '20170914200000 +0200');
$programme->addTitle(new Tv\Elements\Title('CNN News', 'en'));
$programme->addDescription(new Tv\Elements\Desc('World news', 'en'));
$programme->addCategory(new Tv\Elements\Category('news', 'en'));

$tv->addChannel($channel);
$tv->addProgramme($programme);

$xml = XmlTv::generate($tv, $validate = true);