PHPackages                             webalternatif/flysystem-dsn - 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. webalternatif/flysystem-dsn

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

webalternatif/flysystem-dsn
===========================

A set of factories to build Flysystem adapters from DSN (Data Source Name)

v0.7.0(8mo ago)29.4k↓42.3%22MITPHPPHP 8.2.\* || 8.3.\* || 8.4.\*CI passing

Since Aug 30Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/webalternatif/flysystem-dsn)[ Packagist](https://packagist.org/packages/webalternatif/flysystem-dsn)[ RSS](/packages/webalternatif-flysystem-dsn/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (11)Used By (2)

Flysystem DSN
=============

[](#flysystem-dsn)

[![Source code](https://camo.githubusercontent.com/9b8ddc7e56da16a99ff97b3a2bf8574dbb0d4ead97f47acc88d308eb47ef5730/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d4769744875622d626c7565)](https://github.com/webalternatif/flysystem-dsn)[![Packagist Version](https://camo.githubusercontent.com/14f3100a1ecd52f0eb6786710f21ad1d613fc4f108b706f9261a1166ba062436/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776562616c7465726e617469662f666c7973797374656d2d64736e)](https://packagist.org/packages/webalternatif/flysystem-dsn)[![Software license](https://camo.githubusercontent.com/67642e191753833505776b7ba33b221111ae0ae8f336f3981d003e91ae69fa05/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f776562616c7465726e617469662f666c7973797374656d2d64736e)](https://github.com/webalternatif/flysystem-dsn/blob/main/LICENSE)[![GitHub issues](https://camo.githubusercontent.com/f9b551312024771ba9714a9aabaddcbb25b188352713b8e3e52c5b16ef1949f2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f776562616c7465726e617469662f666c7973797374656d2d64736e)](https://github.com/webalternatif/flysystem-dsn/issues)
[![Test status](https://camo.githubusercontent.com/e82c263c15dc465483532659058067241d1a541b1028cf1b6d3097bfd297de5d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f776562616c7465726e617469662f666c7973797374656d2d64736e2f746573742e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473)](https://github.com/webalternatif/flysystem-dsn/actions/workflows/test.yml)[![Psalm coverage](https://camo.githubusercontent.com/fd3e726e201de41a8de2e92f05684ece9c3a02b2ac7b05bdd0adae3f9b09ca3f/68747470733a2f2f73686570686572642e6465762f6769746875622f776562616c7465726e617469662f666c7973797374656d2d64736e2f636f7665726167652e737667)](https://psalm.dev)[![Psalm level](https://camo.githubusercontent.com/216629ff58659a4382c33cfe8bd4f9f36ef4a9fc59238716ee81355514bb1400/68747470733a2f2f73686570686572642e6465762f6769746875622f776562616c7465726e617469662f666c7973797374656d2d64736e2f6c6576656c2e737667)](https://psalm.dev)[![Mutation testing badge](https://camo.githubusercontent.com/0b662e2f097e997c97a61d01cd7cf96ab4d91447dcef796a9519aa7ea847683e/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246776562616c7465726e61746966253246666c7973797374656d2d64736e2532466d61696e)](https://dashboard.stryker-mutator.io/reports/github.com/webalternatif/flysystem-dsn/main)

A set of factories to build [Flysystem](https://flysystem.thephpleague.com) adapters from DSN strings, like:

- `s3://user:pass@endpoint?region=region&bucket=bucket` [↓](#aws-s3)
- `local://some/path` [↓](#local)
- `sftp://user@host:port/absolute/path?private_key=secret.pem` [↓](#sftp)
- [and more...](#adapters)

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

[](#installation)

```
$ composer require webalternatif/flysystem-dsn
```

Because this package does not explicitely require inner adapters, you will have to `composer require` them yourself in your project.
See the [adapters section](#adapters) to know how to install them.

Usage
-----

[](#usage)

```
use Webf\Flysystem\Dsn\AdapterFactory\AwsS3AdapterFactory;
use Webf\Flysystem\Dsn\AdapterFactory\FlysystemAdapterFactory;
use Webf\Flysystem\Dsn\AdapterFactory\OpenStackSwiftAdapterFactory;

$factory = new FlysystemAdapterFactory([
    new AwsS3AdapterFactory(),
    new OpenStackSwiftAdapterFactory(),
]);

$adapter = $factory->createAdapter($dsn);
```

Adapters
--------

[](#adapters)

### AWS S3

[](#aws-s3)

Inner adapter[`league/flysystem-aws-s3-v3`](https://github.com/thephpleague/flysystem-aws-s3-v3)Install[`composer require league/flysystem-aws-s3-v3`](https://packagist.org/packages/league/flysystem-aws-s3-v3)Factory class`Webf\Flysystem\Dsn\AdapterFactory\AwsS3AdapterFactory`DSN`s3://username:password@endpoint?region=region&bucket=bucket`- Use `s3+http://` if the endpoint does not support https.
- `s3://` is equivalent to `s3+https://`.
- `username` is the access key id.
- `password` is the secret access key.

#### Optional DSN parameters

[](#optional-dsn-parameters)

- `version` (default: `latest`)

### Failover

[](#failover)

Inner adapter[`webalternatif/flysystem-failover-bundle`](https://github.com/webalternatif/flysystem-failover-bundle)Install[`composer require webalternatif/flysystem-failover-bundle`](https://packagist.org/packages/webalternatif/flysystem-failover-bundle)Factory class`Webf\Flysystem\Dsn\AdapterFactory\FailoverAdapterFactory`DSN`failover(inner1:// inner2:// ...)?name=name`- There must be at least two DSN arguments for the failover DSN function.
- The `name` parameter is used for the failover adapter's name in the failover bundle (used to identify adapters in Symfony commands).
- For each inner DSN, you can specify a `time_shift` parameter (see [configuration section](https://github.com/webalternatif/flysystem-failover-bundle#configuration) of the failover bundle for more info). This parameter is removed from the inner DSN when it's built.

### Ftp

[](#ftp)

Inner adapter[`league/flysystem-ftp`](https://github.com/thephpleague/flysystem-ftp)Install[`composer require league/flysystem-ftp`](https://packagist.org/packages/league/flysystem-ftp)Factory class`Webf\Flysystem\Dsn\AdapterFactory\FtpAdapterFactory`DSN`ftp://username:password@host:port/absolute/path`- Port is optional and defaults to `21`
- If the path contains spaces, replace each one by `%20`.

#### Optional DSN parameters

[](#optional-dsn-parameters-1)

- `ssl`: whether to use [`ftp_ssl_connect`](https://www.php.net/manual/en/function.ftp-ssl-connect.php) instead of [`ftp_connect`](https://www.php.net/manual/en/function.ftp-connect.php) (default: `false`)
- `timeout`: timeout for all network operations (default: `90`)
- `utf8`: whether to enable the UTF-8 mode or not (default: `false`)
- `passive`: whether to enable the passive mode or not (default: `true`)
- `transfer_mode`: transfer mode used for [`ftp_fget`](https://www.php.net/manual/en/function.ftp-fget.php) and [`ftp_fput`](https://www.php.net/manual/en/function.ftp-fput.php) calls (must be `ascii` or `binary`, default: `binary`)
- `system_type`: system type of the ftp server (must be `unix` or `windows`)
- `ignore_passive_address`: whether to set the [`FTP_USEPASVADDRESS`](https://www.php.net/manual/en/function.ftp-set-option.php) option to the opposite
- `timestamps_on_unix_listings`: whether to set last modified in metadata or not for unix systems (default: `false`)
- `recurse_manually`: whether to recurse directories "manually" instead of using the FTP option when the `$deep` parameter of `listContents()` is set to `true` (default: `false`)
- `public_file_permission`: unix permission for public files (default: `0644`)
- `private_file_permission`: unix permission for public files (default: `0600`)
- `public_dir_permission`: unix permission for public files (default: `0755`)
- `private_dir_permission`: unix permission for public files (default: `0700`)
- `default_dir_visibility`: default visibility for automatically created directories (must be `public` or `private`, default: `private`)

### In memory

[](#in-memory)

Inner adapter[`league/flysystem-memory`](https://github.com/thephpleague/flysystem-memory)Install[`composer require league/flysystem-memory`](https://packagist.org/packages/league/flysystem-memory)Factory class`Webf\Flysystem\Dsn\AdapterFactory\InMemoryAdapterFactory`DSN`in-memory://`#### Optional DSN parameters

[](#optional-dsn-parameters-2)

- `default_visibility`: default visibility of created files and directories (must be `public` or `private`, default: `public`)

### Lazy

[](#lazy)

This adapter allows deferring the creation of the inner adapter until it is actually used (i.e., when Flysystem's methods are called). This is useful when you don't want an adapter to be created, but you need to have it somewhere (e.g., in a service container), and the creation of the adapter is expensive (e.g., it makes a network request).

The drawback is that you have to make sure the DSN of the inner adapter is valid, otherwise an exception will be thrown at "usage" time.

Inner adapter`Webf\Flysystem\Dsn\Adapter\LazyAdapter`Factory class`Webf\Flysystem\Dsn\AdapterFactory\LazyAdapterFactory`DSN`lazy(inner://)`- There must be exactly one DSN argument for the lazy DSN function.

### Local

[](#local)

Inner adapterBuilt-in with [`league/flysystem`](https://github.com/thephpleague/flysystem)Factory class`Webf\Flysystem\Dsn\AdapterFactory\LocalAdapterFactory`DSN`local://absolute_or_relative_path`- If the path contains spaces, replace each one by `%20`.

#### Optional DSN parameters

[](#optional-dsn-parameters-3)

- `public_file_permission`: unix permission for public files (default: `0644`)
- `private_file_permission`: unix permission for public files (default: `0600`)
- `public_dir_permission`: unix permission for public files (default: `0755`)
- `private_dir_permission`: unix permission for public files (default: `0700`)
- `default_dir_visibility`: default visibility for automatically created directories (must be `public` or `private`, default: `private`)

### OpenStack Swift

[](#openstack-swift)

Inner adapter[`webalternatif/flysystem-openstack-swift`](https://github.com/webalternatif/flysystem-openstack-swift)Install[`composer require webalternatif/flysystem-openstack-swift`](https://packagist.org/packages/webalternatif/flysystem-openstack-swift)Factory class`Webf\Flysystem\Dsn\AdapterFactory\OpenStackSwiftAdapterFactory`DSN`swift://username:password@endpoint?region=region&container=container`- Use `swift+http://` if the endpoint does not support https.
- `swift://` is equivalent to `swift+https://`.
- `username` is optional if parameter `user_id` is present.
- `temp_url_key` (see below) is required to be able to generate temporary URLs.

#### Optional DSN parameters

[](#optional-dsn-parameters-4)

- `user_id`: `auth.identity.password.user.id` value sent to Keystone v3 API
- `user_domain_id`: `auth.identity.password.user.domain.id` value sent to Keystone v3 API (default: `default` if `user_id` and `user_domain_name` are not defined)
- `user_domain_name`: `auth.identity.password.user.domain.name` value sent to Keystone v3 API
- `domain_id`: `auth.scope.domain.id` value sent to Keystone v3 API
- `domain_name`: `auth.scope.domain.name` value sent to Keystone v3 API
- `project_id`: `auth.scope.project.id` value sent to Keystone v3 API
- `project_name`: `auth.scope.project.name` value sent to Keystone v3 API
- `project_domain_id`: `auth.scope.project.domain.id` value sent to Keystone v3 API
- `project_domain_name`: `auth.scope.project.domain.name` value sent to Keystone v3 API
- `temp_url_key`: secret key used to generate temporary URLs (more information [here](https://github.com/webalternatif/flysystem-openstack-swift#generating-temporary-urls))

### Prefix

[](#prefix)

Inner adapter[`league/flysystem-path-prefixing`](https://github.com/thephpleague/flysystem-path-prefixing)Install[`composer require league/flysystem-path-prefixing`](https://packagist.org/packages/league/flysystem-path-prefixing)Factory class`Webf\Flysystem\Dsn\AdapterFactory\PrefixAdapterFactory`DSN`prefix(inner://)?path=some/prefix/path`- There must be exactly one DSN argument for the prefix DSN function.
- If the path contains spaces, replace each one by `%20`.

### ReadOnly

[](#readonly)

Inner adapter[`league/flysystem-read-only`](https://github.com/thephpleague/flysystem-read-only)Install[`composer require league/flysystem-read-only`](https://packagist.org/packages/league/flysystem-read-only)Factory class`Webf\Flysystem\Dsn\AdapterFactory\ReadOnlyAdapterFactory`DSN`readonly(inner://)`- There must be exactly one DSN argument for the readonly DSN function.

### Sftp

[](#sftp)

Inner adapter[`league/flysystem-sftp-v3`](https://github.com/thephpleague/flysystem-sftp-v3)Install[`composer require league/flysystem-sftp-v3`](https://packagist.org/packages/league/flysystem-sftp-v3)Factory class`Webf\Flysystem\Dsn\AdapterFactory\SftpAdapterFactory`DSN`sftp://username:password@host:port/absolute/path`- The password can be empty if the `private_key` parameter is defined.
- Port is optional and defaults to `22`
- If the path contains spaces, replace each one by `%20`.

#### Optional DSN parameters

[](#optional-dsn-parameters-5)

- `private_key`: absolute path of a private key file, can be used instead of password
- `passphrase`: passphrase of the private key
- `use_agent`: whether to use ssh agent or not (default: `false`)
- `timeout`: request timeout in seconds (default: `10`)
- `max_retries`: number of connection retries before triggering an error (default: `4`)
- `host_fingerprint`: the host fingerprint to check
- `public_file_permission`: unix permission for public files (default: `0644`)
- `private_file_permission`: unix permission for public files (default: `0600`)
- `public_dir_permission`: unix permission for public files (default: `0755`)
- `private_dir_permission`: unix permission for public files (default: `0700`)
- `default_dir_visibility`: default visibility for automatically created directories (must be `public` or `private`, default: `private`)

Tests
-----

[](#tests)

To run all tests, execute the command:

```
composer test
```

This will run [Psalm](https://psalm.dev), [PHPUnit](https://phpunit.de), [Infection](https://infection.github.io) and a [PHP-CS-Fixer](https://cs.symfony.com/)check, but you can run them individually like this:

```
composer psalm
composer phpunit
composer infection
composer cs-check
```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance61

Regular maintenance activity

Popularity29

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 95.3% of commits — single point of failure

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 ~164 days

Recently: every ~315 days

Total

10

Last Release

243d ago

PHP version history (5 changes)v0.1.0PHP 8.0.\*

v0.3.2PHP 8.0.\* || 8.1.\*

v0.5.0PHP 8.0.\* || 8.1.\* || 8.2.\*

v0.5.1PHP 8.0.\* || 8.1.\* || 8.2.\* || 8.3.\*

v0.6.0PHP 8.2.\* || 8.3.\* || 8.4.\*

### Community

Maintainers

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

---

Top Contributors

[![chapa](https://avatars.githubusercontent.com/u/457659?v=4)](https://github.com/chapa "chapa (61 commits)")[![dbu](https://avatars.githubusercontent.com/u/76576?v=4)](https://github.com/dbu "dbu (1 commits)")[![robertobermejo](https://avatars.githubusercontent.com/u/221931?v=4)](https://github.com/robertobermejo "robertobermejo (1 commits)")[![ThomasLandauer](https://avatars.githubusercontent.com/u/1054469?v=4)](https://github.com/ThomasLandauer "ThomasLandauer (1 commits)")

---

Tags

filesystemFlysystemadapterstoragedsn

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/webalternatif-flysystem-dsn/health.svg)

```
[![Health](https://phpackages.com/badges/webalternatif-flysystem-dsn/health.svg)](https://phpackages.com/packages/webalternatif-flysystem-dsn)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[league/flysystem-async-aws-s3

AsyncAws S3 filesystem adapter for Flysystem.

2610.5M31](/packages/league-flysystem-async-aws-s3)[nimbusoft/flysystem-openstack-swift

Flysystem adapter for OpenStack Swift

44774.4k6](/packages/nimbusoft-flysystem-openstack-swift)

PHPackages © 2026

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