Download the PHP package kfriars/php-array-to-file without Composer
On this page you can find all versions of the php package kfriars/php-array-to-file. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kfriars/php-array-to-file
More information about kfriars/php-array-to-file
Files in kfriars/php-array-to-file
Package php-array-to-file
Short Description Convert a php array into a .php file that can be included
License MIT
Homepage https://github.com/spatie/php-array-to-file
Informations about the package php-array-to-file
Convert a php array into an includeable php file
The purpose of this package is to print an array to a file in a reader-friendly format, that can later be included as php. The package supports deeply nested arrays, with numeric, string, boolean and object values.
Installation
You can install the package via composer:
Usage
You can use the static method on for convenient use, or you can inject the class as a dependency, and use .
An example of use:
Would create with the contents:
The package also allows you to transform the values in your array by passing in a callable. The callable receives the value before it is written to the file, and should return the value you desire to have written. You can use it like:
Which will create with the contents:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Kurt Friars
- All Contributors
License
The MIT License (MIT). Please see License File for more information.