PHP code example of jigius / magic-asset

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

    

jigius / magic-asset example snippets




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