PHP code example of cje / storage

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

    

cje / storage example snippets


$diverService = \Cje\Storage\DriverService::getInstance(\Cje\Storage\bases\StorageConstant::LOCAL_DRIVER, [
    'domain' => 'http://localhost',
    'rootPath' => PROJECT_ROOT_PATH,
    'basePath' => 'web/uploads',
    'fullPath' => 'test',
    'isThumb' => true,
    'callBack' => function ($result, $file, $driver) {
        $result->url = $result->url . '?apistyle=222';
        return $result;
    }
]);
$result = $diverService->saveFile(PROJECT_ROOT_PATH . '/web/1.png', '2.png');

// ['url' => 'http://localhost/web/uploads/test/2.png?apistyle=222', 'thumbUrl' => 'http://localhost/web/uploads/thumb/test/2.png]