Download the PHP package filips123/config-writer without Composer
On this page you can find all versions of the php package filips123/config-writer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download filips123/config-writer
More information about filips123/config-writer
Files in filips123/config-writer
Package config-writer
Short Description Lightweight configuration writer for PHP
License MIT
Homepage https://github.com/filips123/ConfigWriter/
Informations about the package config-writer
PHP Config Writer
Lightweight configuration writer for PHP.
Installation
Requirements
PHP Config Writer requires PHP 5.5.9 or higher. Also, the config directory needs to be writable by web server in order to save config file.
Using Composer
The reccomended way to install ConfigWriter is with Composer, dependency manager for PHP.
You should just require filips123/config-writer in your project.
You would only need to include autoloader and namespace in your script.
Manually Installation
Alternatively, you could download files from GitHub and then manually include them in your script.
You whould need to include all files and namespace in your script.
Usage
Making the configuration
Configuration making is possible using ConfigWriter\Config class.
It accepts two parameters, data and comment, and both are optional. Data parameter contains pre-set data for configuration and comment contains additional comment (or code) on top of the configuration file.
Adding records
Records can be added using ConfigWriter\Config::addRecord() method.
They can also have comments, which will be generated in documentation.
Adding sections
Sections visually and functionally separate multiple records. They can be added using ConfigWriter\Config::addSection() method.
They can also have pre-set data using second parameter.
Saving configuration
You can save configuration using ConfigWriter\Config::toString() or ConfigWriter\Config::toFile().
When saving to string, configuration writer is required, and when saving to file, writer will be automatically determined.
Writers can also have specific options for writing.
The only supported writer is for PHP array, but more writers will be added later.
Versioning
This project uses SemVer for versioning. For the versions available, see the tags on this repository.
License
This project is licensed under the MIT license. See the LICENSE file for details.