PHP code example of innmind / encoding

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

    

innmind / encoding example snippets


use Innmind\Filesystem\{
    Adapter\Filesystem,
    Name,
};
use Innmind\TimeContinuum\Earth;
use Innmind\Url\Path;
use Innmind\Encoding\{
    Gzip,
    Tar,
};

$adapter = Filesystem::mount(Path::of('some/directory/'));
$tar = $adapter
    ->get(Name::of('data'))
    ->map(Tar::encode(new Earth\Clock))
    ->map(Gzip::compress())
    ->match(
        static fn($file) => $file,
        static fn() => null,
    );