PHP code example of ujjwal / h-commons

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

    

ujjwal / h-commons example snippets


    $csv =  new CsvModel($data);
    $csv->setFileName('my_file_name');
    return $csv;

    $image =  new ImageModel();
    $image->setFileName('my_file_name.png');// you can use jpeg || jpg || png || gif
    return $image;

// or you can do
    $image =  new ImageModel();
    $thumbnailer = $this->getServiceLocator()->get('WebinoImageThumb');
    $thumb = $thumbnailer->create("path/to/file");
    $thumb->resize($size, $size);// size in pixel
    $image->setPhpThumb($thumb);
    return $image;