fdevs / elfinder-php-connector
4devs Elfinder php connector
1.1.2
2019-05-05 07:07 UTC
Requires
- php: >=5.4
- psr/log: ~1.0
- symfony/http-foundation: ~2.5|~3.0
Requires (Dev)
- fdevs/photatoes: ~1.1
- intervention/image: ~2.0
- symfony/options-resolver: ~2.5|~3.0
Suggests
- fdevs/photatoes: for use PhotatoesDriver
- intervention/image: for use LocalDriver
- symfony/options-resolver: for use LocalDriver
README
ElFinder PHP backend, 5.4 compliant use Client Server Api
Basic Usage
<?php require __DIR__.'/../vendor/autoload.php'; use FDevs\ElfinderPhpConnector\Connector; use FDevs\ElfinderPhpConnector\Driver\LocalDriver; $connector = new Connector(); //add local driver $local = new LocalDriver(); $local->setDriverOptions(['path' => 'uploads', 'rootDir' => 'path/to/web/dir/']); $local->setAdditionalImages([ 'XL' => ['prefix' => 'XL', 'width' => 800, 'height' => 800], 'M' => ['prefix' => 'M', 'width' => 300, 'height' => 300] ]); $connector->addDriver($local); $src = $_SERVER["REQUEST_METHOD"] == 'POST' ? $_POST : $_GET; $cmd = isset($src['cmd']) ? $src['cmd'] : ''; $response = $connector->run($cmd, $src); echo json_encode($response);
Add Photatoes drivers
require __DIR__.'/../vendor/autoload.php'; use FDevs\ElfinderPhpConnector\Connector; use FDevs\ElfinderPhpConnector\Driver\PhotatoesDriver; use FDevs\Photatoes\Manager; use FDevs\Photatoes\Adapter\YandexAdapter; $connector = new Connector(); $manager = new Manager(new YandexAdapter('username')); $photatoes = new PhotatoesDriver($manager); $photatoes->setDriverOptions(['rootName' => 'yandex']); $connector->addDriver($photatoes); $src = $_SERVER["REQUEST_METHOD"] == 'POST' ? $_POST : $_GET; $cmd = isset($src['cmd']) ? $src['cmd'] : ''; $response = $connector->run($cmd, $src); echo json_encode($response);
use your best driver
create driver
<?php namespace App\ElfinderPhpConnector\Driver; use FDevs\ElfinderPhpConnector\Driver\DriverInterface; class BestDriver implements DriverInterface { //... }
add driver
$connector->addDriver(new BestDriver());
if you need use advanced command implements interfaces
FDevs\ElfinderPhpConnector\Driver\Command\AdditionInterface
FDevs\ElfinderPhpConnector\Driver\Command\ArchiveInterface
FDevs\ElfinderPhpConnector\Driver\Command\BaseInterface
FDevs\ElfinderPhpConnector\Driver\Command\FileInterface
FDevs\ElfinderPhpConnector\Driver\Command\ImageInterface
FDevs\ElfinderPhpConnector\Driver\Command\TextInterface