PHP code example of dotsunited / cabinet

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

    

dotsunited / cabinet example snippets





$adapter = new \DotsUnited\Cabinet\Adapter\StreamAdapter(array(
    'base_path' => '/my/base/path',
    'base_uri'  => 'http://static.example.com'
));


$adapter = \DotsUnited\Cabinet\Cabinet::factory('\DotsUnited\Cabinet\Adapter\StreamAdapter', array(
    'base_path' => '/my/base/path',
    'base_uri'  => 'http://static.example.com'
));


$adapter = \DotsUnited\Cabinet\Cabinet::factory(array(
    'adapter' => '\DotsUnited\Cabinet\Adapter\StreamAdapter',
    'config' => array(
        'base_path' => '/my/base/path',
        'base_uri'  => 'http://static.example.com'
    )
));


$adapter->import($external, $file);


$adapter->write($file, $data);


$adapter->read($file);


$adapter->stream($file);


$adapter->copy($src, $dest);


$adapter->rename($src, $dest);


$adapter->unlink($file);


$adapter->exists($file);


$adapter->size($file);


$adapter->type($file);


$adapter->uri($file);


$adapter->setFilenameFilter(new MyFilenameFilter());


$filterChain = new \DotsUnited\Cabinet\Filter\FilterChain();

$filterChain->addFilter(new MyFilenameFilter1());
$filterChain->addFilter(new MyFilenameFilter2());

$adapter->setFilenameFilter($filterChain);


$config = array(
    'level' => 4
);

$adapter->setFilenameFilter(new \DotsUnited\Cabinet\Filter\HashedSubpathFilter($config);