Download the PHP package hambrook/config without Composer
On this page you can find all versions of the php package hambrook/config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package config
Config
A simple Config object that loads a JSON file and lets you access values without having to check if they're set first. Then automatically saves back to the JSON file when your script finishes. It inherits all the getting/setting abilities from Nest.
Example
JSON File (settings.json)
Use a string as the path parameter
We're going two levels in this time, so use an array for the path
What if we try to get something that isn't there? Does it error?
Or we can specify our own default in case of error
Saving
By default, Config will auto-save at the end of the script. If you instanciate Config with false
as the second parameter, then it will no longer auto-save.
You can save at any time by using the save()
function.
Shortcuts
You can use __
(by default) as a separator instead of using an array, then you can do things like...
Who is it for?
Config was built for small CLI scripts and tools. But it can be used anywhere.
Feedback
Tell me if you loved it. Tell me if you hated it. Tell me if you used it and thought "meh". I'm keen to hear your feedback.
Roadmap
- Add any other standard documentation that should be included
- Add proper unit tests
- If you have an idea, let me know.
License
Copyright © 2015 Rick Hambrook
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.