PHPackages                             kodus/tempkit-fs - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kodus/tempkit-fs

Abandoned → [kodus/tempkit](/?search=kodus%2Ftempkit)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

kodus/tempkit-fs
================

Implements a server-side strategy for collection and recovery of PSR-7 UploadedFile objects

28PHP

Since Sep 8Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kodus/tempkit-fs)[ Packagist](https://packagist.org/packages/kodus/tempkit-fs)[ RSS](/packages/kodus-tempkit-fs/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

`kodus/tempkit-fs`
==================

[](#kodustempkit-fs)

This package implements a server-side strategy for temporary collection and recovery of [PSR-7](http://www.php-fig.org/psr/psr-7/) `UploadedFile` objects as files stored in a [Flysystem](http://flysystem.thephpleague.com/) file-system.

This is a fork of [`kodus/tempkit`](https://github.com/kodus/tempkit) which implements the same thing using the regular file-system API in PHP.

[![PHP Version](https://camo.githubusercontent.com/98e06ab279ef7d8f5dc610b12861b445a427f985f0ced740b6982d8fac4b3fe8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e302532422d626c75652e737667)](https://packagist.org/packages/kodus/tempkit-fs)

You can use this service to implement controllers that collect uploaded files posted asynchronously by a browser and return the temporary file UUIDs, then, on completion, recover the uploaded files and move them to permanent storage.

The filename and MIME-type (as posted by the client) will be preserved.

Unrecovered files are automatically flushed after a defined expiration period.

Usage
-----

[](#usage)

Bootstrap the service using an existing Flysystem `FilesystemInterface` instance:

```
$service = new TempFileService($filesystem, __DIR__ . '/temp');
```

In your asynchronous *file* post-controller, collect posted files and return UUIDs:

```
$uuids = [];

foreach ($request->getUploadedFiles() as $file) {
    $uuids[] = $service->collect($file);
}

echo json_encode($uuids);
```

In your *form* post-controller, recover the collected files:

```
foreach ($uuids as $uuid) {
    $file = $service->recover($uuid);

    // get information about recovered file:

    $filename = $file->getClientFilename();
    $media_type = $file->getClientMediaType();

    // move recovered file into permanent storage:

    $file->moveTo(__DIR__ . '/files/' . $file->getClientFilename());
}
```

Note that, if you don't flush the temporary file, it will of course be garbage-collected after the defined expiration period.

Also, if you manually rename or move the temporary file, the JSON meta-data file will be collected and flushed for you immediately when the `TempFile` instance is destroyed.

#### Refer to [`TempFileService`](src/TempFileService.php) for inline documentation.

[](#refer-to-tempfileservice-for-inline-documentation)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5709900?v=4)[Thomas Nordahl Pedersen](/maintainers/thomasnordahl-dk)[@thomasnordahl-dk](https://github.com/thomasnordahl-dk)

![](https://avatars.githubusercontent.com/u/13201214?v=4)[Bo Andersen](/maintainers/boan-jfm)[@boan-jfm](https://github.com/boan-jfm)

![](https://avatars.githubusercontent.com/u/32329468?v=4)[Jesper Østergaard Jensen](/maintainers/JyskFynskeMedierJoej)[@JyskFynskeMedierJoej](https://github.com/JyskFynskeMedierJoej)

![](https://avatars.githubusercontent.com/u/25659854?v=4)[Michelle Fich](/maintainers/mifich)[@mifich](https://github.com/mifich)

---

Top Contributors

[![mindplay-dk](https://avatars.githubusercontent.com/u/103348?v=4)](https://github.com/mindplay-dk "mindplay-dk (15 commits)")

---

Tags

unmaintained

### Embed Badge

![Health badge](/badges/kodus-tempkit-fs/health.svg)

```
[![Health](https://phpackages.com/badges/kodus-tempkit-fs/health.svg)](https://phpackages.com/packages/kodus-tempkit-fs)
```

PHPackages © 2026

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