PHP code example of b-alidra / epg-generator

1. Go to this page and download the library: Download b-alidra/epg-generator 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/ */

    

b-alidra / epg-generator example snippets



    use EPG\Epg;
    use EPG\Providers\TeleramaProvider;
    use EPG\Providers\Sniffers\TeleramaSniffer;

    $sniffer  = new TeleramaSniffer();
    $provider = new TeleramaProvider($sniffer);

    $channel_ids  = [1, 9, 217, 13];
    $days_to_grab = 3;

    $provider
        // Filter on channels, optional
        ->filter_on_channels($channel_ids)
        // Grab 3 days, default 1
        ->set_days_to_grab($days_to_grab);

    $epg = new Epg($provider);

    $xml_guide = $epg->get_xml();
bash
% php vendor/bin/epg.php epg:generate
bash
% php vendor/bin/epg.php epg:channels
     
+----------------+------------------------------+
| ID             | Channel                      |
+----------------+------------------------------+
| TNT (4)                                       |
+----------------+------------------------------+
| 1              | TF1                          |
| 9              | France 2                     |
| 21             | France 3                     |
| 7              | Canal+                       |
| 13             | France 5                     |
| 28             | M6                           |
| 25             | Arte                         |
| 64             | C8                           |
| 29             | W9                           |
| 38             | TMC                          |
| 65             | NT 1                         |
| 63             | NRJ 12                       |
| 45             | La Chaine parlementaire      |
                 ...