Download the PHP package mireiawen/configuration without Composer

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

Configuration

Configuration file helpers to read different file formats.

Requirements

Installation

You can clone or download the code from the GitHub repository or you can use composer: composer require mireiawen/configuration

Example

JSON specific methods

__construct

JSON class constructor

Arguments

Type Name Description
string $filename The JSON file name to read

Exceptions thrown

Type Description
MissingExtension When expected extensions are not available
InvalidFile When the configuration file is missing or not readable

YAML specific methods

__construct

YAML class constructor

Arguments

Type Name Description
string $filename The YAML file name to read

Exceptions thrown

Type Description
MissingExtension When expected extensions are not available
InvalidFile When the configuration file is missing or not readable

Common interface methods


Has

Check if the configuration variable exists and is set.

Arguments

Type Name Description
string $key The key to check

Return value

Type Description
bool TRUE if the value exists and is set, FALSE if the value does not exist

Get

Get the configuration variable and return its value, or default if it is not set.

Arguments

Type Name Description
string $key The key to retrieve
mixed $default The default value for the key, set to NULL to throw error if key is not set

Return value

Type Description
mixed The value of the key, or the provided default if key is not set

Exceptions thrown

Type Description
MissingValue In case the key is not available and default value is not set

GetString

Get the configuration variable and return its value, or default if it is not set, and validating the type

Arguments

Type Name Description
string $key The key to retrieve
string|null $default The default value for the key, set to NULL to throw error if key is not set

Return value

Type Description
string The value of the key, or the provided default if key is not set

Exceptions thrown

Type Description
MissingValue In case the key is not available and default value is not set
\TypeError In case the value is not of type string

GetInt

Get the configuration variable and return its value, or default if it is not set, and validating the type

Arguments

Type Name Description
string $key The key to retrieve
int|null $default The default value for the key, set to NULL to throw error if key is not set

Return value

Type Description
int The value of the key, or the provided default if key is not set

Exceptions thrown

Type Description
MissingValue In case the key is not available and default value is not set
\TypeError In case the value is not of type int

GetFloat

Get the configuration variable and return its value, or default if it is not set, and validating the type

Arguments

Type Name Description
string $key The key to retrieve
float|null $default The default value for the key, set to NULL to throw error if key is not set

Return value

Type Description
float The value of the key, or the provided default if key is not set

Exceptions thrown

Type Description
MissingValue In case the key is not available and default value is not set
\TypeError In case the value is not of type float

GetBool

Get the configuration variable and return its value, or default if it is not set, and validating the type

Arguments

Type Name Description
string $key The key to retrieve
bool|null $default The default value for the key, set to NULL to throw error if key is not set

Return value

Type Description
bool The value of the key, or the provided default if key is not set

Exceptions thrown

Type Description
MissingValue In case the key is not available and default value is not set
\TypeError In case the value is not of type bool

GetAsString

Get the configuration variable and return its value, or default if it is not set, and casting the return value to correct type

Arguments

Type Name Description
string $key The key to retrieve
string|null $default The default value for the key, set to NULL to throw error if key is not set

Return value

Type Description
string The value of the key, or the provided default if key is not set

Exceptions thrown

Type Description
MissingValue In case the key is not available and default value is not set

GetAsInt

Get the configuration variable and return its value, or default if it is not set, and casting the return value to correct type

Arguments

Type Name Description
string $key The key to retrieve
int|null $default The default value for the key, set to NULL to throw error if key is not set

Return value

Type Description
int The value of the key, or the provided default if key is not set

Exceptions thrown

Type Description
MissingValue In case the key is not available and default value is not set

GetAsFloat

Get the configuration variable and return its value, or default if it is not set, and casting the return value to correct type

Arguments

Type Name Description
string $key The key to retrieve
float|null $default The default value for the key, set to NULL to throw error if key is not set

Return value

Type Description
float The value of the key, or the provided default if key is not set

Exceptions thrown

Type Description
MissingValue In case the key is not available and default value is not set

GetAsBool

Get the configuration variable and return its value, or default if it is not set, and casting the return value to correct type

Arguments

Type Name Description
string $key The key to retrieve
bool|null $default The default value for the key, set to NULL to throw error if key is not set

Return value

Type Description
bool The value of the key, or the provided default if key is not set

Exceptions thrown

Type Description
MissingValue In case the key is not available and default value is not set

All versions of configuration with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.0
ext-gettext Version *
ext-json Version *
ext-yaml Version *
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 mireiawen/configuration contains the following files

Loading the files please wait ....