Download the PHP package nabeghe/configurator without Composer

On this page you can find all versions of the php package nabeghe/configurator. 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 configurator

Nabeghe Configurator for PHP

A PHP configuration management library that supports file-based storage and loads each section lazily.


Features


Installation

Install via Composer:

Usage

  1. Create a configuration class and extend it from Configurator.
  2. Define the DEFAULTS constant in this class. This constant is an array that can contain arbitrary values. Each key represents a section, and its value is an array of that section’s configuration values (for example: db, log, etc.).
  3. It is recommended to create a separate class for each section. This class is used only for IDE type hinting and has no other functional purpose. In this class, you can define the keys that the section may contain, along with their types, using @property annotations in the docblock comments. This class must extend the Proxy class, because each section is a Proxy.
  4. Instantiate your configuration class.

Configurator Constructor

The constructor accepts three parameters:

Note 1:
By default, the directory path is null. If it is not set, loading configuration from files and persisting configurations is not possible. Therefore, if your configuration is file-based, you should set this path.

Note 2:
Injecting data together with a directory path is allowed. In this case, the injected sections will no longer be loaded from their corresponding files.

Cache file

A file named _.cache is reserved. If APCu is not available, the list of existing configuration files is stored in this file. Although the system automatically updates the list, it is recommended to delete the _.cache file whenever you add a new file or remove an existing one.

Configurator class

Method Description
__construct($path, $config, $apcuAllowed) Initialize configurator with path, initial config and cache option
__get($name) Get a Proxy instance for a config section
__set($name, $value) Set or create a config section (via Proxy)
getPath() Get configuration directory path
setPath($value) Set configuration directory path
isLoadable() Check if file loading/saving is enabled
hasDefault($section, $key) Check if a default value exists
getDefault($section, $key) Get default value for a key
getDefaults($section) Get all default values of a section
has($section, $key) Check if a key exists in a section
get($section, $key) Get a config value (falls back to default)
set($section, $key, $value) Set a config value
setOnce($section, $key, $value) Set a value only if it does not exist
dot($path, $value = null) Get/set config using dot-notation
del($section, $key) Delete a key from a section
getAll($section = null, $addDefaults = false) Get all config data
setAll($sectionOrArray, $config = []) Replace section or full config
getKeys($section, $addDefaults = false) Get keys of a section
isEmpty($section = null) Check if section or config is empty
generatePath($section) Generate file path for a section
load($proxyOrName) Load section config from file
save($proxyOrName = null) Save section(s) to file
clear($proxyOrName) Clear config values of a section
delete($proxyOrName) Delete config file of a section
eject($proxyOrName) Remove section from memory
ejectAll($excepts = []) Remove all sections except given ones
each($section, $callback, $addDefaults = false) Iterate over section values
mkdirs($path, $permissions) Recursively create directories
getCacheName() Get cache identifier name
hasCache() Check if cache exists
getCache() Retrieve cached metadata
updateCache() Update cache with file metadata
delCache() Delete cache entry
offsetExists($offset) ArrayAccess: check section exists
offsetGet($offset) ArrayAccess: get section Proxy
offsetSet($offset, $value) ArrayAccess: set section
offsetUnset($offset) ArrayAccess: remove section

Proxy class

This class is used for each configuration section.

Method Description
__construct($configurator, $name) Create a proxy for a configuration section
offsetExists($key) ArrayAccess: check if a key exists
offsetGet($key) ArrayAccess: get a value by key
offsetSet($key, $value) ArrayAccess: set a value by key
offsetUnset($key) ArrayAccess: remove a key
__get($key) Get a config value via property access
__set($key, $value) Set a config value via property access
has($key) Check if a key exists in the section
getName() Get section name
getDefaults() Get default values of the section
getKeys() Get all keys in the section
isEmpty() Check if section is empty
getAll($addDefaults = false) Get all config values
setAll($config) Replace all section values
hasDefault($key) Check if a default exists for key
getDefault($key) Get default value for key
load() Load section config from file
save() Save section config to file
clear() Clear all values in section
delete() Delete section config file
eject() Remove section from memory
each($callback, $addDefaults = false) Iterate over key-value pairs

📖 License

Licensed under the MIT license, see LICENSE.md for details.


All versions of configurator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
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 nabeghe/configurator contains the following files

Loading the files please wait ...