jaylinski / xmltv
A library for generating XMLTV files.
v4.0.0
2023-04-16 22:02 UTC
Requires
- php: >=8.0
- ext-dom: *
- ext-libxml: *
- ext-xmlwriter: *
Requires (Dev)
- friends-of-phpspec/phpspec-code-coverage: ^6.3
- friendsofphp/php-cs-fixer: ^3.16
- phpspec/phpspec: ^7.3
- phpstan/phpstan: ^1.10
README
A library for generating XMLTV files.
Installation
Install the latest version with
$ composer require jaylinski/xmltv
Usage
<?php use XmlTv\Tv; use XmlTv\XmlTv; require __DIR__.'/vendor/autoload.php'; $tv = new Tv(); $channel = new Tv\Channel('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);
A more detailed example can be found in the specification test.
Sources
You can write your own source by implementing the XmlTv\Tv\Source
interface.
License
XMLTV is licensed under the MIT License - see the LICENSE
file for details.