PHPackages                             alextartan/flysystem-libsodium-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. alextartan/flysystem-libsodium-adapter

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

alextartan/flysystem-libsodium-adapter
======================================

On-the-fly encrypt and decrypt flysystem files

2.0.1(6y ago)326.7k—0%2[12 PRs](https://github.com/alextartan/flysystem-libsodium-adapter/pulls)Apache-2.0PHPPHP &gt;=7.4

Since Jul 23Pushed 3y agoCompare

[ Source](https://github.com/alextartan/flysystem-libsodium-adapter)[ Packagist](https://packagist.org/packages/alextartan/flysystem-libsodium-adapter)[ RSS](/packages/alextartan-flysystem-libsodium-adapter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (15)Versions (21)Used By (0)

Libsodium Adapter for Flysystem
===============================

[](#libsodium-adapter-for-flysystem)

Performing on-the-fly client-side encryption for safe storage of files.

On uploads, the content is encrypted using [Poly 1305](https://en.wikipedia.org/wiki/Poly1305) with a secret key and stored securely on the filesystem.

On downloads, the content is decrypted.

Current build status
====================

[](#current-build-status)

[![CI](https://github.com/alextartan/flysystem-libsodium-adapter/workflows/CI/badge.svg?branch=master)](https://github.com/alextartan/flysystem-libsodium-adapter/workflows/CI/badge.svg?branch=master)[![codecov](https://camo.githubusercontent.com/9ef8db9f0526c5a60015ba3e143cfe295d938e3104685dd36808b7e4fdb3f7f0/68747470733a2f2f636f6465636f762e696f2f67682f616c657874617274616e2f666c7973797374656d2d6c6962736f6469756d2d616461707465722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/alextartan/flysystem-libsodium-adapter)[![Infection MSI](https://camo.githubusercontent.com/2eabf2d74d87a197f900b4d296456d3088b8776784bcac62566de8d6fc11c38e/68747470733a2f2f62616467652e737472796b65722d6d757461746f722e696f2f6769746875622e636f6d2f616c657874617274616e2f666c7973797374656d2d6c6962736f6469756d2d616461707465722f6d6173746572)](https://infection.github.io)[![Dependabot Status](https://camo.githubusercontent.com/9239a71c7407b8ab3eabed9f63b18573a50d648cc3d1605d823a3bef8f3b2cbf/68747470733a2f2f6170692e646570656e6461626f742e636f6d2f6261646765732f7374617475733f686f73743d676974687562267265706f3d616c657874617274616e2f666c7973797374656d2d6c6962736f6469756d2d61646170746572)](https://dependabot.com)[![Downloads](https://camo.githubusercontent.com/492438acd7f1e663a9ffcc9bb623d610faf74d8439e9fe6fd8972910ffe88180/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64796e616d69632f6a736f6e2e7376673f75726c3d68747470733a2f2f7265706f2e7061636b61676973742e6f72672f7061636b616765732f616c657874617274616e2f666c7973797374656d2d6c6962736f6469756d2d616461707465722e6a736f6e266c6162656c3d446f776e6c6f6164732671756572793d242e7061636b6167652e646f776e6c6f6164732e746f74616c26636f6c6f72423d6f72616e6765)](https://packagist.org/packages/alextartan/flysystem-libsodium-adapter)

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

[](#installation)

```
composer require alextartan/flysystem-libsodium-adapter
```

Usage
-----

[](#usage)

```
use AlexTartan\Flysystem\Adapter\ChunkEncryption\Libsodium;use AlexTartan\Flysystem\Adapter\EncryptionAdapterDecorator;
use League\Flysystem\Filesystem;
use League\Flysystem\Memory\MemoryAdapter;

$adapter = new MemoryAdapter();
$encryption = Libsodium::factory($encryptionKey, 4096);

$adapterDecorator = new EncryptionAdapterDecorator(
    $adapter,
    $encryption
);

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

**Notice**;

Due to how AwsS3 (and probably other remote adapters) handle stream uploads, I had to change the way this lib worked (versions up to `v.1.0.0`)

New releases employ a `php://temp` stream in which the encryption is done and once that finishes, the stream is sent to `writeStream`/`readStream`

Performance wise, it handles ok from what i could see.

Versioning
----------

[](#versioning)

This library adheres to [semver](https://semver.org/)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 58.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 ~26 days

Recently: every ~45 days

Total

8

Last Release

2310d ago

Major Versions

0.9.6 → 1.0.02019-07-24

1.0.1 → 2.0.02020-01-20

PHP version history (2 changes)0.9PHP &gt;=7.2

2.0.0PHP &gt;=7.4

### Community

Maintainers

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

---

Top Contributors

[![alextartan](https://avatars.githubusercontent.com/u/1787996?v=4)](https://github.com/alextartan "alextartan (35 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (12 commits)")

---

Tags

flysystemflysystem-adapterlibsodium-phpFlysystemencryptionlibsodium

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/alextartan-flysystem-libsodium-adapter/health.svg)

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

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

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

Symfony bundle integrating Flysystem into Symfony applications

40129.5M87](/packages/league-flysystem-bundle)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6129.6M91](/packages/league-flysystem-sftp-v3)[league/flysystem-memory

In-memory filesystem adapter for Flysystem.

8533.6M194](/packages/league-flysystem-memory)[league/flysystem-async-aws-s3

AsyncAws S3 filesystem adapter for Flysystem.

2610.5M31](/packages/league-flysystem-async-aws-s3)[sistemi-etime/flysystem-plugin-aws-s3-v3

AWS S3 plugin for Flysystem.

11154.2k1](/packages/sistemi-etime-flysystem-plugin-aws-s3-v3)

PHPackages © 2026

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