PHPackages                             whc-projects/flysystem-pdo-adapter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. whc-projects/flysystem-pdo-adapter

ActiveLibrary[File &amp; Storage](/categories/file-storage)

whc-projects/flysystem-pdo-adapter
==================================

PDO adapter for Flysystem file abstraction layer

1.0.5(8y ago)02671MITPHP

Since Nov 22Pushed 7y ago2 watchersCompare

[ Source](https://github.com/whc-projects/flysystem-pdo-adapter)[ Packagist](https://packagist.org/packages/whc-projects/flysystem-pdo-adapter)[ RSS](/packages/whc-projects-flysystem-pdo-adapter/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)Dependencies (2)Versions (7)Used By (0)

Flysystem PDO Database Adapter
==============================

[](#flysystem-pdo-database-adapter)

[![Build Status](https://camo.githubusercontent.com/82b9513d6240a29081e9370c3d56713b6e0653aee3ce147779b070c336d8824a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f496e74656772616c536f6674776172652f666c7973797374656d2d70646f2d616461707465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/IntegralSoftware/flysystem-pdo-adapter)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)

PDO database adapter for [Flysystem](https://github.com/thephpleague/flysystem) filesystem abstraction. No additional dependencies, only PDO extension required.

Installation
------------

[](#installation)

```
composer require integral/flysystem-pdo-adapter

```

Database Configuration
----------------------

[](#database-configuration)

At the beginning you have to create a table that will be used to store files.

SQL table schema examples for MySQL and SQLite are presented below.

**MySQL**

```
CREATE TABLE files (
  id int(11) NOT NULL AUTO_INCREMENT,
  path varchar(255) NOT NULL,
  type enum('file','dir') NOT NULL,
  contents longblob,
  size int(11) NOT NULL DEFAULT 0,
  mimetype varchar(127),
  timestamp int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (id),
  UNIQUE KEY path_unique (path)
);
```

Usage
-----

[](#usage)

Create an adapter by passing a valid `PDO` object and table name as constructor arguments:

**MySQL**

```
// http://php.net/manual/pl/ref.pdo-mysql.connection.php
$pdo = new PDO('mysql:host=hostname;dbname=database_name', 'username', 'password');
$adapter = new PDOAdapter($pdo, 'files');
```

**SQLite**

```
// http://php.net/manual/pl/ref.pdo-sqlite.connection.php
$pdo = new PDO('sqlite:/absolute/path/to/database.sqlite');
$adapter = new PDOAdapter($pdo, 'files');
```

**PostgreSQL**

```
// http://php.net/manual/pl/ref.pdo-pgsql.php
$pdo = new PDO('pgsql:host=localhost;port=5432;dbname=testdb;user=bruce;password=mypass');
$adapter = new PDOAdapter($pdo, 'public.files');
```

Then simply pass the created adapter to `\League\Flysystem\Filesystem`:

```
$filesystem = new Filesystem($adapter);
```

Done! At this point the `$filesystem` is ready to use.

Note
----

[](#note)

This implementation emulates a tree structured filesystem, therefore some of the operations (like renaming or deleting a folder) produce quite a lot of database queries, which may result in a poor performance for some scenarios.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~152 days

Recently: every ~60 days

Total

6

Last Release

3114d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb178e6448bf64ce2cd99f422ab149f4d7976d1ecdfe89a352338e68e3b01b86?d=identicon)[womenhowzeh](/maintainers/womenhowzeh)

---

Top Contributors

[![zaak](https://avatars.githubusercontent.com/u/803299?v=4)](https://github.com/zaak "zaak (3 commits)")[![bstoots](https://avatars.githubusercontent.com/u/5334637?v=4)](https://github.com/bstoots "bstoots (2 commits)")[![hossein142001](https://avatars.githubusercontent.com/u/4927133?v=4)](https://github.com/hossein142001 "hossein142001 (1 commits)")[![rezaei121](https://avatars.githubusercontent.com/u/3050755?v=4)](https://github.com/rezaei121 "rezaei121 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/whc-projects-flysystem-pdo-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/whc-projects-flysystem-pdo-adapter/health.svg)](https://phpackages.com/packages/whc-projects-flysystem-pdo-adapter)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.7k285.7M1.0k](/packages/league-flysystem-aws-s3-v3)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.5M85](/packages/unisharp-laravel-filemanager)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[league/flysystem-bundle

Symfony bundle integrating Flysystem into Symfony applications

40432.5M136](/packages/league-flysystem-bundle)[alexusmai/laravel-file-manager

File manager for Laravel

1.2k803.2k9](/packages/alexusmai-laravel-file-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
