jigius/magic-asset

魔法资产的文件编码/解码器

0.0.1 2022-06-14 07:22 UTC

This package is auto-updated.

Last update: 2024-09-14 12:37:50 UTC


README

魔法资产的文件编码/解码器

示例

<?php

use MagicAsset\Vanilla;

$uri =
    (new Vanilla\EncodedFile())
        ->withFile("path/to/file.jpg")
        ->withSecret("someSecret")
        ->withTasks(
            (new Vanilla\TkCollection())
                ->with(
                    (
                    (new Vanilla\TkDumb())->with("foo")
                    )
                )
                ->with(
                    (
                    (new Vanilla\TkDumb())->with("bar")
                    )
                )
                ->with(
                    (
                    (new Vanilla\TkDumb())->with("baz")
                    )
                )
        )
        ->URI();
        
echo "Encoded: {$uri}\n";

$d = (new Vanilla\DecodedURI())
    ->withURI($uri)
    ->withSecret("someSecret")
    ->decoded();
echo "Decoded: {$d->file()}\n\n";

echo "Tasks' result: \n";
$d->tasks()->each(function ($t) {
    $t->execute();
    echo "\n";
});
?>