PHPackages                             dnj/tmp-filesystem - 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. dnj/tmp-filesystem

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

dnj/tmp-filesystem
==================

Simple local interface to work with temporary files and directories

1.1.0(4y ago)05187MITPHPPHP &gt;=7.4

Since Sep 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/dnj/tmp-filesystem)[ Packagist](https://packagist.org/packages/dnj/tmp-filesystem)[ RSS](/packages/dnj-tmp-filesystem/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (7)

PHP Temporary FileSystem (Simple local interface to work with temporary files and directories)
==============================================================================================

[](#php-temporary-filesystem-simple-local-interface-to-work-with-temporary-files-and-directories)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4608d4c7f448fa8841f371efe2b08da4c7201c98ef76bb327636551d54e64a60/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646e6a2f746d702d66696c6573797374656d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dnj/tmp-filesystem)[![Total Downloads](https://camo.githubusercontent.com/275e14e7c8997ff80edd9116f279b8ef2daae05ea9173e353e3bf33a51ba7b32/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646e6a2f746d702d66696c6573797374656d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dnj/tmp-filesystem)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/dnj/tmp-filesystem/blob/master/LICENSE)[![Testing status](https://github.com/dnj/tmp-filesystem/actions/workflows/test.yml/badge.svg)](https://github.com/dnj/tmp-filesystem/actions/workflows/test.yml)

Introduction
------------

[](#introduction)

This is a simple implemenetation of [DNJ\\FileSystem](https://github.com/dnj/filesystem) for working with temporary disk based file system.

- Latest versions of PHP and PHPUnit and PHPCsFixer
- Best practices applied:
    - [`README.md`](https://github.com/dnj/tmp-filesystem/blob/master/README.md) (badges included)
    - [`LICENSE`](https://github.com/dnj/tmp-filesystem/blob/master/LICENSE)
    - [`composer.json`](https://github.com/dnj/tmp-filesystem/blob/master/composer.json)
    - [`phpunit.xml`](https://github.com/dnj/tmp-filesystem/blob/master/phpunit.xml)
    - [`.gitignore`](https://github.com/dnj/tmp-filesystem/blob/master/.gitignore)
    - [`.php-cs-fixer.php`](https://github.com/dnj/tmp-filesystem/blob/master/.php-cs-fixer.php)
- Some useful resources to start coding

How To Use
----------

[](#how-to-use)

First of all, you need to add this library to your project, so run:

```
composer require dnj/tmp-filesystem
```

Working with this filesystem is same as working with [DNJ\\local-filesystem](https://github.com/dnj/local-filesystem)
But you don't need to specify `$path` in the constructor of the Nodes. Because the file or directory is created in the temporary path of the operationg system.

For more information to how deal with this filesystem, you can read [DNJ\\local-filesystem README.md](https://github.com/dnj/local-filesystem/blob/master/README.md)

Also, you don't need to delete temporary file and directories manually, because they have been automatically deleted when there is no pointer to them. (technically, when the `__destruct` method of object called.)

### Create temporary file:

[](#create-temporary-file)

```
