Skip to content

jigius/magic-asset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

magic-asset

Data encoder/decoder for a magic asset's file

Example

<?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";
});
?>

About

Data encoder/decoder for a magic asset's file

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages