Installation
composer require "a5sys/pydio-bundle"
Add to config/bundles.php (Laravel 5.4+):
A5sys\PydioBundle\PydioBundle::class => ['dev' => true],
(For Symfony, register in AppKernel.php under dev environment.)
Configuration
Define parameters in config/parameters.yml:
pydio_base_url: 'https://your-pydio-instance.com'
pydio_api_url: '/pydio/api/v2'
pydio_login: 'your_username'
pydio_password: 'your_password'
Reference them in config/packages/pydio.yaml (or config.yml for Symfony):
pydio:
base_api_url: '%pydio_base_url%'
api_url: '%pydio_api_url%'
login: '%pydio_login%'
password: '%pydio_password%'
First Use Case
Inject pydio.directory_service into a controller/service and list directories:
use A5sys\PydioBundle\Service\DirectoryService;
class MyController extends Controller
{
public function __construct(private DirectoryService $directoryService) {}
public function listDirectories()
{
$directories = $this->directoryService->listDirectories('workspace_id');
return response()->json($directories);
}
}
Directory Operations
$this->directoryService->listDirectories('workspace_id', 'parent_folder_id');
$this->directoryService->createDirectory('workspace_id', 'parent_folder_id', 'new_folder_name');
$this->directoryService->removeDirectory('workspace_id', 'folder_id');
File Operations
pydio.file_service):
$this->fileService->createFile(
'workspace_id',
'parent_folder_id',
'filename.txt',
$fileContent,
'text/plain'
);
$content = $this->fileService->getFileContent('workspace_id', 'file_id');
Search Functionality
$results = $this->searchService->search('workspace_id', 'query', 'file');
.env for credentials (avoid hardcoding).404 Not Found):
try {
$this->directoryService->listDirectories('invalid_id');
} catch (\Exception $e) {
Log::error('Pydio API Error: ' . $e->getMessage());
return response()->json(['error' => 'Workspace not found'], 404);
}
GuzzleHttp\RetryMiddleware).AppServiceProvider:
public function register()
{
$this->app->bind(
\A5sys\PydioBundle\Service\DirectoryService::class,
function ($app) {
return $app->make('pydio.directory_service');
}
);
}
class SyncPydioCommand extends Command
{
protected $fileService;
public function __construct(FileService $fileService)
{
parent::__construct();
$this->fileService = $fileService;
}
public function handle()
{
// Sync logic here
}
}
Deprecated Bundle
guzzlehttp/guzzle for modern HTTP clients).Authentication Failures
config.yml are insecure. Use Laravel’s .env:
PYDIO_LOGIN=your_login
PYDIO_PASSWORD=your_password
$client = new \GuzzleHttp\Client([
'handler' => \GuzzleHttp\HandlerStack::create([
new \GuzzleHttp\Middleware::tap(function ($request) {
Log::debug('Pydio Request:', ['url' => (string) $request->getUri()]);
}),
]),
]);
API URL Mismatches
base_api_url (e.g., https://pydio.example.com) and api_url (e.g., /pydio/api/v2) form a valid endpoint.Route::get('/pydio/health', function () {
$client = new \GuzzleHttp\Client();
try {
$response = $client->get(config('pydio.base_api_url') . config('pydio.api_url'));
return 'Pydio API reachable: ' . $response->getStatusCode();
} catch (\Exception $e) {
return 'Pydio API unreachable: ' . $e->getMessage();
}
});
Workspace/Folder IDs
$directories = $this->directoryService->listDirectories('workspace_id');
Log::debug('Pydio Directory IDs:', array_keys($directories));
$client = new \GuzzleHttp\Client([
'debug' => true,
'handler' => \GuzzleHttp\HandlerStack::create([
new \GuzzleHttp\Middleware::tap(function ($request, $options) {
Log::debug('Request:', [
'url' => (string) $request->getUri(),
'method' => $request->getMethod(),
'headers' => $request->getHeaders(),
]);
}),
new \GuzzleHttp\Middleware::tap(function ($response) {
Log::debug('Response:', [
'status' => $response->getStatusCode(),
'body' => (string) $response->getBody(),
]);
}),
]),
]);
curl -X GET "http://myPydioInstance/pydio/api/v2/workspace/workspace_id/directory" \
-u "pydioLogin:pydioPassword"
Custom Services
Extend existing services (e.g., add shareService for Pydio’s sharing API):
namespace App\Service;
use A5sys\PydioBundle\Service\AbstractService;
class ShareService extends AbstractService
{
protected $endpoint = 'share';
public function createShare($workspaceId, $fileId, $options)
{
return $this->post($workspaceId, $fileId, $options);
}
}
Register in config/services.yaml:
services:
App\Service\ShareService:
arguments:
$client: '@pydio.http_client'
$baseUrl: '%pydio.base_api_url%'
$apiUrl: '%pydio.api_url%'
Event Listeners Listen for Pydio API events (e.g., file uploads) using Symfony’s event dispatcher:
namespace App\EventListener;
use A5sys\PydioBundle\Event\FileUploadedEvent;
class PydioEventListener
{
public function onFileUploaded(FileUploadedEvent $event)
{
Log::info('File uploaded to Pydio:', [
'file_id' => $event->getFileId(),
'workspace' => $event->getWorkspaceId(),
]);
}
}
Bind in config/services.yaml:
services:
App\Event
How can I help you explore Laravel packages today?