Download the PHP package mr-luke/configuration without Composer

On this page you can find all versions of the php package mr-luke/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 Host

Latest Stable Version Total Downloads License

Tests Workflow Quality Gate Status Security Rating Reliability Rating

This package provides array host (wrapper) package that supports dot notation access and schema validation.

Getting Started

Good software development follows many patterns and architectures. We design things that depends on many other parts. Some of them are well structured Objects but many times we need to have some configurations. Often we use array as our config host but it can produce mass of unexpected side-effects becasue of one reason - array is not an Object so it can't follow any schema. But what if it can...

During my work I developed a simple wrapper tool that helped me with schema sensitive arrays and I decided to make it a package. I hope you enjoy it!

Installation

To install through composer, simply put the following in your composer.json file and run composer update

Or use the following command

Usage

Let's move to a Schema class. It's a validation tool with one interface method:

By default check method throws an InvalidArgumentException when $insert doesn't follow schema.

Step One

Create your Schema array:

Available rules:

Step Two

Create new instance of Mrluke\Configuration\Schema:

Note! From v1.2.0 you can create Schema by static method createFromFile(string $path, bool $json = false).

Step Three

Create new instance of Mrluke\Configuration\Host with Schema as a dependency and your $configArray is automatically validated.

If your $configArray doesn't follow given Schema, you will get InvalidArgumentException. You can also use Host without any Schema due to it's optional parameter of Mrluke\Configuration\Host.

Your configuration is Wrapped!

Now you have an access to Host methods:

Your key can follow dot notation to access nested keys:

By default if key is not present, Host returns null. You can also use magic getter to acces config:

You can check if given hey is present:

Plans

Feel free to contribute because I am aware that there are some things to improve. For now:


All versions of configuration with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-json 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 mr-luke/configuration contains the following files

Loading the files please wait ....