dnj / tmp-filesystem
Simple local interface to work with temporary files and directories
Requires
- php: >=7.4
- dnj/local-filesystem: ^1.0.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.1
- phpstan/phpstan: ^0.12.68
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-17 13:45:01 UTC
README
Introduction
This is a simple implemenetation of DNJ\FileSystem for working with temporary disk based file system.
- Latest versions of PHP and PHPUnit and PHPCsFixer
- Best practices applied:
README.md
(badges included)LICENSE
composer.json
phpunit.xml
.gitignore
.php-cs-fixer.php
- Some useful resources to start coding
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
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
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:
<?php use dnj\Filesystem\Tmp\File; $tmpFile = new File(); echo $tmppFile->getPath(); // prints the path of temporary file, in linux, it's may something like this: /tmp/qyiuqgi
Create temporary directory:
<?php use dnj\Filesystem\Tmp\Directory; $tmpDirectory = new Directory(); echo $tmpDirectory->getPath(); // prints the path of temporary directory, in linux, it's may something like this: /tmp/qyiuqgi
About
We'll try to maintain this project as simple as possible, but Pull Requests are welcomed!
License
The MIT License (MIT). Please see License File for more information.