PHP code example of optimumsage / m3u-parser-php

1. Go to this page and download the library: Download optimumsage/m3u-parser-php 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/ */

    

optimumsage / m3u-parser-php example snippets


use OptimumSage\M3uParser\M3uParser;
...
$data = M3uParser::fromUrl([
'https://iptv-org.github.io/iptv/categories/animation.m3u', 
'https://iptv-org.github.io/iptv/categories/business.m3u'
])->get();
...
$data = M3uParser::fromUrl('https://iptv-org.github.io/iptv/index.m3u')->get(); // returns stdClass
...
$data = M3uParser::fromUrl('https://iptv-org.github.io/iptv/index.m3u')->toArray(); // return array
...
$data = M3uParser::fromUrl('https://iptv-org.github.io/iptv/index.m3u')->toJson(); // return json