Download the PHP package philiprehberger/php-config-loader without Composer

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

PHP Config Loader

Tests Latest Version on Packagist Last updated

Load configuration from JSON, PHP, YAML, and TOML files with environment variable substitution.

Requirements

Installation

Usage

Loading a Single File

PHP config file (app.php):

JSON config file (database.json):

Dot-Notation Access

Typed Getters

Checking Key Existence

Environment Variable Substitution

Config values containing ${VAR} are resolved from environment variables at load time. Use ${VAR:default} to provide a fallback.

Loading a Directory

Load all .php, .json, .yaml, .yml, and .toml files from a directory. Each file's basename (without extension) becomes a top-level key.

Deep Merge

Combine two configurations with deep merging. Values from the second config override the first; nested arrays are merged recursively.

Flattening Nested Config

Convert nested configuration into a flat associative array with dot-notation keys.

Configuration Validation

Validate config values against a set of rules. Rules are pipe-separated.

Supported rules: required, string, int, bool, float.

API

Method Return Type Description
ConfigLoader::load(string $path) Config Load a single config file (PHP, JSON, YAML, TOML)
ConfigLoader::loadDirectory(string $dir) Config Load all config files from a directory
Config::get(string $key, mixed $default = null) mixed Get value by dot-notation key
Config::string(string $key, string $default = '') string Get string value
Config::int(string $key, int $default = 0) int Get integer value
Config::bool(string $key, bool $default = false) bool Get boolean value
Config::float(string $key, float $default = 0.0) float Get float value
Config::array(string $key, array $default = []) array Get array value
Config::has(string $key) bool Check if key exists
Config::all() array Get all config data
Config::keys() array Get all top-level configuration keys
Config::merge(Config $other) Config Deep merge with another config
Config::flatten(string $separator = '.') array Flatten nested config to dot-notation key-value pairs
Config::validate(array $rules) array Validate config against rules, returns violation messages

Development

Support

If you find this project useful:

Star the repo

🐛 Report issues

💡 Suggest features

❤️ Sponsor development

🌐 All Open Source Projects

💻 GitHub Profile

🔗 LinkedIn Profile

License

MIT


All versions of php-config-loader with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 philiprehberger/php-config-loader contains the following files

Loading the files please wait ...