PHP code example of kitpages / util-bundle

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

    

kitpages / util-bundle example snippets

 php
 // app/autoload.php

$loader->registerNamespaces(array(
    // ...
    'Kitpages' => __DIR__.'/../vendor/bundles',
));
 php 
 // app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Kitpages\UtilBundle\KitpagesUtilBundle(),
    );
}
 php


$util = $this->get('kitpages.util');
// create recursively a directory
$util->mkdirr("/tmp/test/foo/bar");
// delete recursively the test directory
$util->rmdirr("/tmp/test");
// send a jpg image to the browser with a 3600 expire time
$util->getFile("/tmp/toto.jpg", 3600)