PHPackages                             salamek/nette-tempnam - 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. salamek/nette-tempnam

ActiveLibrary

salamek/nette-tempnam
=====================

This is a simple tempnam extension for Nette Framework

1.1.4(4y ago)0173LGPL-3.0PHP

Since Jul 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Salamek/nette-tempnam)[ Packagist](https://packagist.org/packages/salamek/nette-tempnam)[ RSS](/packages/salamek-nette-tempnam/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (3)Versions (12)Used By (0)

Nette tempnam
=============

[](#nette-tempnam)

This is a simple tempnam extension for [Nette Framework](http://nette.org/)It creates temp files in %tempDir%/tempnam

Why ?
-----

[](#why-)

Sometines you just need to create tempfile such as PDF, Latte templates etc... and you dont want to put them into `sys_get_temp_dir()` (/tmp) and keep them in your Nette project %tempDir%... or just acces same temp file multiple times

Instalation
-----------

[](#instalation)

The best way to install salamek/nette-tempnam is using [Composer](http://getcomposer.org/):

```
$ composer require salamek/nette-tempnam:@dev
```

Then you have to register extension in `config.neon`.

```
extensions:
    tempnam: Salamek\Tempnam\DI\TempnamExtension
```

If you wish to change tempnam path just add this to your config:

```
tempnam:
   tempDir: %tempDir%/tempnam
```

Usage example
-------------

[](#usage-example)

```
/** @var Salamek\Tempnam\Tempnam @inject */
public $tempnam;

$key = 'my_tempnam_key_1'; // Lets say ID of record in database
$data = 'My File COntent'; // Lets say record from database we want as file
$updatedAt = new \DateTime('YYYY-mm-dd'); // Lets say updatedAt column from database to expire tempnam file when record in database is changed

// Load temFile Path or null
$tempFile = $this->tempnam->load($key, $updatedAt);

if ($tempFile === null)
{
    $tempFile = $this->tempnam->save($key, $data, $updatedAt);
}

echo file_get_contents($tempFile); // My File COntent
```

Methods
-------

[](#methods)

```
$this->tempnam->getTempDir(); //Returns tempDir
$this->tempnam->remove($key); //Removes tempnam file by its $key
$this->tempnam->load($key, \DateTimeInterface $updatedAt = null); //Returns tempnam file path by its key if updatedAt matches or returns null
$this->tempnam->save($key, $data, \DateTimeInterface $updatedAt = null) //Saves tempnam file by $key with $data content, returns tempnam path
```

###  Health Score

30

—

LowBetter than 67% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~168 days

Recently: every ~0 days

Total

11

Last Release

1479d ago

### Community

Maintainers

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

---

Top Contributors

[![Salamek](https://avatars.githubusercontent.com/u/1226241?v=4)](https://github.com/Salamek "Salamek (25 commits)")

---

Tags

nettetemporarynettetempnam

### Embed Badge

![Health badge](/badges/salamek-nette-tempnam/health.svg)

```
[![Health](https://phpackages.com/badges/salamek-nette-tempnam/health.svg)](https://phpackages.com/packages/salamek-nette-tempnam)
```

###  Alternatives

[kdyby/translation

Integration of Symfony/Translation into Nette Framework

891.2M22](/packages/kdyby-translation)[kdyby/redis

Redis storage for Nette Framework

491.6M2](/packages/kdyby-redis)[nette/web-project

Nette: Standard Web Project

10991.2k](/packages/nette-web-project)[kdyby/autowired

Syntax sugar for working with services in Nette Framework

31875.7k7](/packages/kdyby-autowired)[kdyby/doctrine-cache

Doctrine Cache bridge for Nette Framework

101.3M16](/packages/kdyby-doctrine-cache)

PHPackages © 2026

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