Download the PHP package v-dem/queasy-config without Composer

On this page you can find all versions of the php package v-dem/queasy-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 queasy-config

Codacy Badge Build Status codecov Mutation testing badge Total Downloads License

QuEasy PHP Framework - Configuration

Package v-dem/queasy-config

This package contains a set of the classes intended for reading configuration files. Formats currently supported are:

Features

Requirements

Reference

See Wiki page.

Installation

> composer require v-dem/queasy-config:master-dev

Usage

Let's imagine we have the following config.php:

Or config.ini:

Or config.json:

Or config.xml:

You can mix different config types, for example top-level config of PHP type can refer to config files of other types.

Creating config instance

Include Composer autoloader:

Create config instance (config file type will be detected by file name extension):

Accessing config instance

Now you can address config sections and options these ways:

Or:

It's possible to use a default value if an option is missing:

A bit shorter way:

It's also possible to point that an option is required, and to throw ConfigException if this option is missing:

How to check if a section or an option is present in config:

If you don't want to check each section for presence when accessing a very nested option, you can use this trick:

A bit shorter way:

Multi-file configs

config.php:

queries.php:

Accessing:

Almost the same for other config formats:

config.ini:

There can be any PHP code after @queasy: so it's possible to use PHP constants etc. Be careful, eval() function is used to execute this expression.

Different config formats can be mixed this way.

Merging configs

You can use Config's merge() method to merge two configs. For example, you can have a default configuration and allow users to add or override some options:

Using CLI config type

As an addition it's possible to use command-line arguments as config options source for CLI scripts (just use .cli extension, it will create appropriate loader):

Options should be passed this way (unfortunately only this is supported currently):

> php test.php option1=123 option2="some text"

I think it's useful to utilize merge() method there - default config file and optional arguments from command line.

Testing

Tests can be run with miminum PHP 7.2 version due to PHPUnit requirements. To run them use

> composer test

All versions of queasy-config with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0|>=7.0.0
v-dem/queasy-helper Version dev-master
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 v-dem/queasy-config contains the following files

Loading the files please wait ....