Download the PHP package neunerlei/filesystem without Composer
On this page you can find all versions of the php package neunerlei/filesystem. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download neunerlei/filesystem
More information about neunerlei/filesystem
Files in neunerlei/filesystem
Package filesystem
Short Description A static wrapper around the symfony filesystem with additional methods for extra flavor
License Apache-2.0
Informations about the package filesystem
File System
This package contains a static wrapper around the symfony file system component with some
additional features.
Since version 5.3 it also contains an extension for the Path
utility, and replaces Neunerlei/path-util.
Installation
Install this package using composer:
Filesystem Utility
The filesystem class can be found at .
getFs()
Returns the singleton instance of the symfony file system class
copy()
Copies a file or a directory. If the target file is older than the origin file, it's always overwritten.
mkdir()
Creates a directory recursively.
exists()
Checks the existence of files or directories.
isReadable()
Tells whether a file or list of files exists and is readable.
isWritable()
Tells whether a file or list of files exists and is writable.
isFile()
Tells whether a file or list of paths exists and contains only files
isDir()
Tells whether a file or list of paths exists and contains only directories
touch()
Sets access and modification time of file.
NOTE: You can also pass DateTime objects as timestamps!
remove()
Removes files or directories.
flushDirectory()
Removes all contents from a given directory without removing the element itself.
getDirectoryIterator()
Helper to create a directory iterator either for a single folder or recursively. Dots will automatically be skipped. It can also find only files matching a regular expression. By default the folder will come after the children, which can be toggled using the options.
rename()
Allows you to rename a file or directory
getPermissions()
Returns the unix file permissions for a given file like "0777" as a string.
setPermissions()
Can be used to set the unix permissions for a file or folder.
getOwner()
Returns the numeric unix user id for the given file or folder
setOwner()
Can be used to update the owner of a given file or folder
getGroup()
Returns the numeric unix user group for the given filename
setGroup()
Can be used to update the group of a given file or folder
readFile()
A wrapper around file_get_contents which reads the contents, but handles unreadable or non existing files with speaking exceptions.
readFileAsLines()
A wrapper around file() which handles non existing, or unreadable files with speaking exceptions.
writeFile()
Writes the given content into a file on your file system.
appendToFile()
Appends content to an existing file. By default all content will be added on a new line.
Path Utility
The filesystem class can be found at .
Running tests
- Clone the repository
- Install the dependencies with
- Run the tests with
Special Thanks
Special thanks goes to the folks at LABOR.digital (which is the word german for laboratory and not the english "work" :D) for making it possible to publish my code online.
Postcardware
You're free to use this package, but if it makes it to your production environment I highly appreciate you sending me a postcard from your hometown, mentioning which of our package(s) you are using.
You can find my address here.
Thank you :D