PHP code example of strukt / pkg-asset

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

    

strukt / pkg-asset example snippets


Env::withFile(".env");
env("root_dir", getcwd());

// $finder = new \Strukt\Asset($root_dir, $static_dir);
// $finder = asset($root_dir, $static_dir);
$finder = asset();
$finder->exists("/js/script.js");
$finder->getInfo("/js/script.js");//SplFileInfo
$finder->get("/js/script.js");//returns contents of file

$image = new \Gumlet\ImageResize();
$image = new \Gumlet\ImageResize('image.jpg');
$image->scale(50);
$image->save('image2.jpg')

$image = new \Gumlet\ImageResize('image.jpg');
$image->resizeToHeight(500);
$image->save('image2.jpg')