PHP code example of raulfraile / distill

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

    

raulfraile / distill example snippets


use Distill\Distill;

$distill = new Distill();
$distill->extract(__DIR__ . '/../tests/files/file_ok.zip', __DIR__ . '/extract');

use Distill\Distill;

$distill = new Distill();

$preferredFile = $distill
    ->getChooser()
    ->setStrategy(new \Distill\Strategy\MinimumSize())
    ->addFile('http://get.symfony.com/Symfony_Standard_Vendors_2.5.3.zip')
    ->addFile('http://get.symfony.com/Symfony_Standard_Vendors_2.5.3.tgz')
    ->getPreferredFile();

echo $preferredFile; // http://get.symfony.com/Symfony_Standard_Vendors_2.5.3.tgz

use Distill\Distill;

$distill = new Distill();

$preferredFile = $distill
    ->getChooser()
    ->setStrategy(new \Distill\Strategy\UncompressionSpeed())
    ->addFile('test.phar')
    ->addFile('test.zip')
    ->getPreferredFile();

echo $preferredFile; // test.zip