Download the PHP package brunonatali/file without Composer
On this page you can find all versions of the php package brunonatali/file. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download brunonatali/file
More information about brunonatali/file
Files in brunonatali/file
Informations about the package file
File
Use this library to manipulate and interact with the file system.
Note. Some functions or classes cannot interact with the Windows system, so use it with caution.
WARNING: The reactphp/event-loop to work, but it was not added as required in the composer configuration so as not to force the average user to include a library that they will never use, so don't forget to require it when installing your program, if you are going to use this class.
Table of Contents
- OnFileChange
- Polling example
- Inotify example
- OFC Configuration
- OFC start()
- OFC stop()
- OFC setPollingTime()
- OFC static isFileChanged()
- JsonFile
- readAsArray()
- saveArray()
- FileHandler
- Not documented yet
- Install
- License
OnFileChange
OnFileChange is a little help for you to monitor when a file has been modified and take some action from it.
Read the following notes
This class supports debug by including brunonatali/tools in your composer project.
ATENTION: The reactphp/event-loop to work, include it by hand in your project!
PERFORMANCE: For performance purpouses install the inotify PECL extension and include brunonatali/inotify in your project.
Polling example
Inotify example
Install brunonatali/inotify in your project by typing:
OFC Configuration
Configuations are passed in array format on 4th OnFileChange() arg as follows:
OFC start()
Used to starts watching file change. Only takes effect when stoped or initialized with 'auto_start' => false.
This function dos not return nothing.
OFC stop()
Stops file change verification. This function dos not return nothing.
OFC setPollingTime()
Configure polling time when using this method.
OFC static isFileChanged()
You can manually check file changes by calling isFileChanged(). This function is provided statically to could be called by hand
JsonFile
This class is available with static functions for easy interaction, with the objective of easy manipulation / creation of JSON files.
readAsArray()
Reads entire json file as array. This function is meant to be a function to simplify use of native PHP functions file_get_contents() and json_decode(), adding some validations.
Simple call:
saveArray()
Save provided array to a JSON file, returning a boolean success result.
You can provide PHP JSON flags.
FileHandler
File handler was designed to be an stream file reader, but was not reviewed and not documented yet.
Install
The recommended way to install this library is through Composer. New to Composer?
This project follows SemVer. This will install the latest supported version:
This project aims to run on Linux and require other components and inotify PHP extension, to work properly, follow each section instructions to get what you need.
If you find a bug, please report.
License
MIT, see LICENSE file.