PHP code example of akiosarkiz / mp3php

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

    

akiosarkiz / mp3php example snippets


use AkioSarkiz\Mp3Php\Mp3;

// create object
$mp3item = new Mp3('source.mp3');

// check is valid
$mp3item->isValid();

// get duration of mp3
$mp3item->getDuration();

// add meta
$mp3item->addMeta([
    'album' => 'custom album',
], 'source_with_meta.mp3');

// clear meta
$mp3item->clearMeta('source_clear.mp3');

// get all info
$mp3item->getInfo();

// get path
$mp3item->getPath();

// get size mp3
$mp3item->size();

// get kbs of mp3
$mp3item->getKbs();

// convert mp3 to your kbs
$mp3item->convert('source_64.mp3', 64);