Download the PHP package loilo/x-filesystem without Composer
On this page you can find all versions of the php package loilo/x-filesystem. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download loilo/x-filesystem
More information about loilo/x-filesystem
Files in loilo/x-filesystem
Package x-filesystem
Short Description An extension to Symfony's Filesystem Component, able to read and write PHP/YAML/JSON/CSV files
License MIT
Informations about the package x-filesystem
# eXtended Filesystem
An extension to Symfony's Filesystem Component with
- recursive globbing support
- methods for reading and writing some popular data exchange formats (PHP, JSON, YAML, CSV)
Installation
Usage
XFilesystem
is instantiated exactly like Filesystem
:
No existing behavior is modified, every method available in Filesystem
works exactly as expected.
Find Files through Globs
This method matches the behavior of PHP's built-in glob
function, but adds support for the recursive wildcard /**/
:
Signature
Example
Read Plain Files
Filesystem
has no built-in way to read plain files, so here we go:
Signature
Example
Read Files from URLs
By default, HTTP(S) URLs are not allowed as filenames when reading a file. This can however be adjusted through setting the remoteAllowed
flag:
Inversely, you can check whether remote access is enabled via $fs->isRemoteAllowed()
.
Read JSON Files
Signature
Example
data.json
read-json.php
>>>
Write JSON Files
Signature
Example
write-json.php
>>>
Read YAML Files
Signature
Example
data.yaml
read-yaml.php
>>>
Write YAML Files
Signature
Example
write-yaml.php
>>>
Read CSV Files
Signature
Example
data.csv
read-csv.php
>>>
Write CSV Files
Signature
Example
write-csv.php
>>>
Read PHP Files
Read PHP files that return
data.
WARNING! This method utilizes PHP's
include
statement and has no safety nets against possible side effects and abuse through arbitrary code execution. Only ever use this with trusted files!
Signature
Example
data.php
read-php.php
Write PHP Files
Signature
Example
write-php.php
>>>
All versions of x-filesystem with dependencies
php Version >= 8.0
symfony/filesystem Version ^3|^4|^5
symfony/yaml Version ^3|^4|^5