library file
File wrapper
- Wednesday, November 22, 2017
- by dermatthes
- Repository
- 1 Watchers
- 0 Stars
- 619 Installations
- PHP
- 1 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 17 % Grown
Phore :: file
file wrapper, (*1)
Proof of concept: Don't use in production!, (*2)
Features
-
File-Locking:
content()
uses flock to lock file access
Examples
pfile("../file.txt")->content()
pfile("../file.txt")->lock()->content("New Content")->unlock();
pfile("directory/../file.txt")->resolve()->mustExist()->unlink();
Load Encoded data
pfile("file.json")->json();
pfile("file.yml")->yaml();
Write Encoded data
pfile("file.json")->json(["some"=>"data"]);
pfile("file.yml")->yaml(["some"=>"data"]);
Stream data
pfile("file.json")->fopen("w+")->fwrite("someData")->fclose();