Download the PHP package pinepain/simple-config without Composer

On this page you can find all versions of the php package pinepain/simple-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package simple-config

WARNING: This project is UNSUPPORTED and ABANDONED

Php Simple Config

Build Status

About

This is yet another library to deal with Config values. It designed to be obvious, minimal, lightweight, fast and extensible.

This library combines approaches used by well-known and recognizable PHP (and not limited to) frameworks.

Features:

Installation:

composer require pinepain/simple-config 0.*

Configs loading:

As this library tries to keep things simple, Config class requires only array of config items, so you may have any configs loading logic you want and your application needs.

Right out of the box there are FilesLoader configs loade which simply require's all files in single directory and store returned items in config array under file's basename (file name without path to it and its extension) key.

Limitation:

Assume, we have such directory tree:

then loading configs from config directory will load only app.php, cache.php and db.php files and will ignore .dotfile.php and mail.php.old files and will skip somedir/ content completely.

Note:

Files with dots in it names (not counting dot between basename and extension) will leads to undiscoverable config section, e.g. config file db.old.php will be interpreted as [ 'db.old' => ... ] entry which can't be accessed via dot notation while we assume that each dot means one nested level.

While having such config section is ambiguous such naming is not supported by this library.

Example:

Note: While this library is rather set of blocks it was built with mind and hope that you will use some IoC container, but you can do all that manually.

Optimizations and caching

As this library tries to keep things simple, Config class requires only array of config items, so you may have any configs loading logic you want and your application needs.

In addition to FilesLoader loader there are FileCacheLoader and MergedFilesLoader loaders which designed to optimize config loading time by storing all config items in one file to reduce file operations. The main difference between them is that FileCacheLoader loader store already calculated config items and MergedFilesLoader combine config files content as is into one file. If you are in hurry - see example below to see the difference between them.

Caching:

If you want to cache loaded config use FileCacheLoader which requires any config loader that implements LoaderInterface interface and file path to store cached config items to. It has very simple logic: it looks for cached file and if it exists than retun itrequred result, if no cached file found, config items loaded with passed loader and then cached to file and after that returned to user.

Optimization:

Out of the box we have FilesLoader loader and FileCacheLoader caching loader which perfectly works together in most cases. But if you follow 12-factor app methodology and store config in the environment and what more, relies on them in your config files, you have to clean cache on every env variable change. In case doing some dynamic calculus in config files you can't use caching at all.

Here MergedFilesLoader loader comes. It requires FilesLoader and file where to store merged config files to.

The loader logic is to merge all config file into one under appropriate section so then only 1 file operation required, but actual code in configs are still executed on require.

MergedFilesLoader is limited to config files parsing and built with hope that it will not be used in situations where configs used for programming, so it supposed that you have simple config with return statement that return config items on require.

MergedFilesLoader built using nikic/php-parser.

Example:

Assume we have two file:

and assume we have not env variables set.

Caching wil lead to following content:

Merging will leads to:

If you change environment variables value and will not invalidate cache then you are likely to run into troubles. With merging you are unlikely to run into such issue. Performance for both FileCacheLoader and MergedFilesLoader are almost the same (run php example/benchmark_loaders.php to see exact results in your environment).

Performance:

You can run benchmarking in your environment with php example/benchmark_loaders.php command.

Here are common results on ssd drive:

This bench run at the end of every travis build, so you can check results by seeing builds result.

Where to go from here:

Use provided ConfigInterface to inject config dependency and use it in your projects. Feels free to report any issues or suggest new Loaders or some new cool ideas to improve this library.

Config interface:

Configs loader interface:

Notes

Features that are not goal of this library:

These features are not goals of this library and are subject of application- or framework-specific logic.


All versions of simple-config with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
nikic/php-parser Version 1.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pinepain/simple-config contains the following files

Loading the files please wait ....