Download the PHP package codezero/configurator without Composer

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

Class Configurator

Build Status Latest Stable Version Total Downloads License

This package allows you to easily inject configuration files into you own classes.

Installation

Download this package or install it through Composer:

"require": {
    "codezero/configurator": "3.*"
}

Usage

Define a configuration

Specify an array...

$config = [
    'my_setting' => 'some value',
    'my_other_setting' => 'some other value'
];

Or refer to a configuration file...

$config = '/path/to/configFile.php';

That configuration file could look like this:

<?php
return [
    'my_setting' => 'some value',
    'my_other_setting' => 'some other value'
];

Use Configurator in your class

Inject a Configurator implementation in your class. If none is supplied, the default one will be instantiated. The $configurator->load() method will return a Configuration object or throw a ConfigurationException if no valid array could be loaded.

use CodeZero\Configurator\Configurator;
use CodeZero\Configurator\DefaultConfigurator;

class MyClass {

    private $config;

    public function __construct($config, Configurator $configurator = null)
    {
        $configurator = $configurator ?: new DefaultConfigurator();
        $this->config = $configurator->load($config);
    }
}

Instantiate your class

Create an instance of your class, passing it the configuration array or file:

$myClass = new MyClass($config);

Use the Configuration in your class

Get configuration values:

$mySetting = $this->config->get('my_setting');
$myOtherSetting = $this->config->get('my_other_setting');

Set configuration values at runtime:

$this->config->set('my_setting', 'some new value');

And that's all there is to it...

Laravel 5 Usage

IoC binding

If you use Laravel, then you can setup a binding that resolves your class with its configuration automatically. Let's say you have a class Acme\MyApp\MyClass:

App::bind('Acme\MyApp\MyClass', function($app)
{
    // Specify an array...
    $config = [
        'my_setting' => 'some value',
        'my_other_setting' => 'some other value'
    ];

    // Or refer to a configuration file...
    $config = '/path/to/configFile.php';

    return new \Acme\MyApp\MyClass($config);
});

Use Laravel's Config infrastructure

What if you don't want to hardcode an array or a file path in your bindings, but instead you want to make use of laravel's Config infrastructure? Let's imagine that you create a Laravel configuration file at config/myapp.php. You could then use this in your binding:

$config = $app['config']->get("myapp");

Simple as that...


Analytics


All versions of configurator with dependencies

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

Loading the files please wait ...