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 3d 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 19% 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://www.gravatar.com/avatar/ec1a54f85a6e46909df4ca4852ada0cc4b1482f7208dfc487d05554087e09cc9?d=identicon)[thomasnordahl-dk](/maintainers/thomasnordahl-dk)

![](https://www.gravatar.com/avatar/9d0432f9ee26cc6265bcf3817d88bf40a4a8669a603785b34946e9c15d7b3451?d=identicon)[boan-jfm](/maintainers/boan-jfm)

![](https://www.gravatar.com/avatar/22799a8c3c482e408f78fd86a999b271f1d5fd2e04b433c6d199f717b3032bb2?d=identicon)[JyskFynskeMedierJoej](/maintainers/JyskFynskeMedierJoej)

![](https://www.gravatar.com/avatar/a974d9ad4b2be14736394ce117f53f83e9186e9cc05002bc004678f0b0587e37?d=identicon)[mifich](/maintainers/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)
```

###  Alternatives

[pacificdev/laravel_9_preset

Default preset for laravel 9 with bootstrap

1026.0k](/packages/pacificdev-laravel-9-preset)

PHPackages © 2026

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