PHP code example of vollbehr / php-reader-laravel

1. Go to this page and download the library: Download vollbehr/php-reader-laravel 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/ */

    

vollbehr / php-reader-laravel example snippets


use Illuminate\Config\Repository;
use Illuminate\Container\Container;
use Vollbehr\Bridge\Laravel\PhpReaderServiceProvider;
use Vollbehr\Support\FileReaderFactory;

final class StubApplication extends Container
{
    public function configPath(string $path = ''): string
    {
        return sys_get_temp_dir() . DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR);
    }
}

$app = new StubApplication();
$app->instance('config', new Repository([
    'php-reader' => [
        'default_file_mode' => 'rb',
    ],
]));

$provider = new PhpReaderServiceProvider($app);
$provider->register();
$provider->boot();

/** @var FileReaderFactory $factory */
$factory = $app->make(FileReaderFactory::class);
$reader  = $factory->open('/path/to/audio.mp3');