PHPackages                             rah/eien - 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. rah/eien

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

rah/eien
========

PHP helper library for handling temporary files

022[1 issues](https://github.com/gocom/eien/issues)PHP

Since Dec 12Pushed 12y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Eien - PHP, have a temporary file
=================================

[](#eien---php-have-a-temporary-file)

[Packagist](https://packagist.org/packages/rah/eien) | [Twitter](http://twitter.com/gocom) | [Issues](https://github.com/gocom/eien/issues) | [![Build Status](https://camo.githubusercontent.com/b1d407d2f1809706311547f3fb9e4b957631a7012dfdfffe0c00a8b350213161/68747470733a2f2f7472617669732d63692e6f72672f676f636f6d2f6569656e2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/gocom/eien)

Eien is a small PHP helper library for handling temporary files. Get, create, make, remove and flush temporary files and directories. Currently unstable, work in progress.

Basic usage
-----------

[](#basic-usage)

### Get a path to an available temporary file

[](#get-a-path-to-an-available-temporary-file)

```
echo (string) new Rah_Eien_Temporary_File();
```

### Create a temporary file and move it to its final location once done

[](#create-a-temporary-file-and-move-it-to-its-final-location-once-done)

The file is moved to location specified with the optional Rah\_Eien\_File::$final option, if defined. The moving is performed once there are no other references to the instance, script is closed or when the move() method is called.

```
$tmp = new Rah_Eien_File();
$tmp->final('/path/to/final/location.txt');
$file = new Rah_Eien_Temporary_File($tmp);
```

If you want moving to happen automatically, the easiest ways are extending, which allows you to perform your actions within it, unsetting the instance once you are done with it or wrapping the instance to its own contexts, like an anonymous function.

### Make a temporary file from an existing file

[](#make-a-temporary-file-from-an-existing-file)

In addition to creating brand new temporary files, or getting paths as strings, you can also create temporary file instances from other files. The specified files are copied to your temporary directory, and you get an instance point to the new temporary instance.

```
$tmp = new Rah_Eien_File();
$tmp->file('/path/to/source/file.txt');
echo (string) new Rah_Eien_Temporary_File($tmp);
```

### Create a new temporary directory and return its path

[](#create-a-new-temporary-directory-and-return-its-path)

```
echo (string) new Rah_Eien_Temporary_Directory();
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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/3a34b4e1b662cd2c926e8e89a76f93df266b199fe61508d38026cb952f28e59e?d=identicon)[rah](/maintainers/rah)

### Embed Badge

![Health badge](/badges/rah-eien/health.svg)

```
[![Health](https://phpackages.com/badges/rah-eien/health.svg)](https://phpackages.com/packages/rah-eien)
```

###  Alternatives

[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.7k](/packages/venveo-craft-compress)

PHPackages © 2026

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