wgg / flysystem-doctrine

Doctrine DBAL 的 Flysystem 适配器

1.0.1 2022-07-01 09:37 UTC

This package is auto-updated.

Last update: 2024-09-12 09:09:47 UTC


README

GitHub Workflow Status Packagist PHP Version Support Packagist Version

这是一个 Doctrine DBAL 的 Flysystem 适配器。

安装

composer require wgg/flysystem-doctrine

引导

<?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);

数据库

在开始时,您必须创建一个用于存储文件的表。SQL 表的架构可以在 schema 文件夹中找到。