wgg/flysystem-doctrine

Flysystem adapter for Doctrine DBAL

1.0.1 2022-07-01 09:37 UTC

This package is auto-updated.

Last update: 2024-04-12 08:08:30 UTC


README

GitHub Workflow Status Packagist PHP Version Support Packagist Version

This is a Flysystem adapter for Doctrine DBAL.

Installation

composer require wgg/flysystem-doctrine

Bootstrap

<?php
use Doctrine\DBAL\DriverManager;
use League\Flysystem\Filesystem;
use WGG\Flysystem\Doctrine\DoctrineDBALAdapter;

$connectionParams = [
    'url' => 'mysql://user:secret@localhost/mydb',
];
$connection = DriverManager::getConnection($connectionParams);

$adapter = new DoctrineDBALAdapter($connection, 'flysystem_files');
$filesystem = new Filesystem($adapter);

Database

At the beginning you have to create a table that will be used to store files. SQL table schema can be found in the schema folder