Download the PHP package phuxtil/splfileinfo without Composer
On this page you can find all versions of the php package phuxtil/splfileinfo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phuxtil/splfileinfo
More information about phuxtil/splfileinfo
Files in phuxtil/splfileinfo
Package splfileinfo
Short Description SplFileInfo compatible implementation that allows to work with virtual (non existing) files
License MIT
Informations about the package splfileinfo
phuxtil-splfileinfo
VirtualSplFileInfo
allows to use non existing (virtual) paths and still be able to perform
all file operations like getSize()
, isFile()
, getOnwer()
, etc, and get predefined results.
It has setters support, and helper methods like isVirtual()
, toArray()
, fromArray()
, fromSplFileInfo()
.
Installation
Note: Use v1.x for compatibility with PHP v7.0.x. Note: Use v2.x for compatibility with PHP v7.2+
Usage
Create virtual file info.
Only PathInfo data is set at this point.
The rest of the data can be updated with setters.
Note: All properties besides PathInfo are set to -1 by default.
Check if resource is virtual.
Update virtual file info with real resource data
VirtualFileInfo
vs \SplFileInfo
.
Extra methods
isVirtual(): bool
Returns true if the and does not really exist.
Note: isReadable(), isFile(),... etc, can return true, even if the resource does not exist.
fromSplFileInfo(\SplFileInfo $info)
toArray(): array
fromArray(array $data)
Setter support
You can use setters for all properties besides PathInfo
, which is resolved by default in \SplFileInfo
.
The resource does not have to yet exist for those methods to work.
Properties with setters:
Default values
All values besides PathInfo
are set to -1
by default.
TDD
See tests for more examples.