1. Go to this page and download the library: Download esplora/decompresso 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/ */
esplora / decompresso example snippets
use Esplora\Lumos\Extractor;
use Esplora\Lumos\Adapters\SevenZipAdapter;
$lumos = Extractor::make([
new SevenZipAdapter(),
])
->extract('/path/to/your/archive.zip');
$lumos->isSuccessful(); // true
$lumos->attempts(); // 1
use Esplora\Lumos\Extractor;
use Esplora\Lumos\Adapters\SevenZipAdapter;
use Esplora\Lumos\Providers\ArrayPasswordProvider;
$passwords = new ArrayPasswordProvider([
'qwerty',
'xxx123',
]);
Extractor::make()
->withAdapters([
new SevenZipAdapter(),
])
->withPasswords($passwords)
->extract('/path/to/your/archive.zip', '/path/to/save/to')
->isSuccessful(); // false
namespace Esplora\Lumos\Adapters;
use Esplora\Lumos\Contracts\AdapterInterface;
use Esplora\Lumos\Contracts\PasswordProviderInterface;
use Esplora\Lumos\Results\SummaryInterface;
class CustomAdapter implements AdapterInterface
{
/**
* Checks if the adapter supports the given file.
*/
public function canSupport(string $filePath): bool
{
return str_ends_with($filePath, '.custom');
}
/**
* Checks if the environment is properly configured.
*/
public function isSupportedEnvironment(): bool
{
return true; // Check external dependencies here
}
/**
* Extracts the content to the specified directory.
*/
public function extract(string $filePath, string $destination, PasswordProviderInterface $passwords): SummaryInterface
{
// Implement extraction logic here
}
}
use Esplora\Lumos\Concerns\SupportsMimeTypes;
class CustomAdapter implements AdapterInterface
{
use SupportsMimeTypes;
/**
* Returns a list of supported MIME types.
*
* @return array<string> An array of supported MIME types.
*/
protected function supportedMimeTypes(): array
{
return [
'application/pdf', // Support for PDF files
'image/jpeg', // Support for JPEG images
];
}
// ...
}
use Esplora\Lumos\Concerns\SupportsFileExtensions;
class CustomAdapter implements AdapterInterface
{
use SupportsFileExtensions;
/**
* Returns a list of allowed file extensions.
*
* @return array<string> An array of allowed extensions.
*/
protected function allowedExtensions(): array
{
return [
'txt', // Support for text files
'zip', // Support for ZIP archives
];
}
// ...
}
use Esplora\Lumos\Adapters\SevenZipAdapter;
new SevenZipAdapter('/usr/bin/7z'),
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.