basilicom/flysystem-pdo
最新稳定版本:v1.1.1
Composer 安装命令:
composer require basilicom/flysystem-pdo
包简介
Flysystem v3 adapter for PDO
README 文档
README
A (very simple) Flysystem v3 adapter for PDO/MySQL`. Based on the https://github.com/thephpleague/flysystem-memory implementation.
Installation
$ composer require basilicom/flysystem-pdo`
Prepare a (MySQL) table:
create table files (
bucket varchar(32) not null default 'default',
path varchar(255) not null,
isFile tinyint not null default 1,
mimeType varchar(64) not null default '',
contents longblob not null,
size int unsigned not null default 0,
checksum varchar(256) not null,
lastModified datetime,
visibility varchar(64),
PRIMARY KEY(bucket, path)
);
Usage
use League\Flysystem\Filesystem; use Basilicom\Flysystem\Pdo\PdoAdapter; $pdo = new PDO('mysql:host=mysql;dbname=mydb', 'myuser', 'mypass'); $adapter = new \Basilicom\Flysystem\Pdo\PdoAdapter($pdo); $flysystem = new Filesystem($adapter);
Example
$path = 'my/path/to/file.txt'; $contents = 'Lorem Ipsum'; $flysystem->write($path, $contents);
Tests
This library uses the FilesystemAdapterTestCase provided by
league/flysystem-adapter-test-utilities, so it performs integration tests
that need a real PDO connection.
To run tests, provide a MySQL database with the files table schema,
duplicate the phpunit.xml.dist file into phpunit.xml and fill
all the environment variables, then run:
$ composer test
This will run PHP-CS-Fixer,[Psalm][3] and [PHPUnit][4], but you can run them individually like this:
$ composer phpcsfixer $ composer psalm $ composer phpunit
统计信息
- 总下载量: 643
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2023-02-12