2017 © Pedro Peláez
 

library quantum

Quantum is unique kind of container made to manage parallel states of data structures.

image

minime/quantum

Quantum is unique kind of container made to manage parallel states of data structures.

  • Friday, December 6, 2013
  • by marcioAlmada
  • Repository
  • 0 Watchers
  • 0 Stars
  • 451 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Minime \ Quantum

Build Status Coverage Status Scrutinizer Quality Score SensioLabsInsight, (*1)

Quantum is unique kind of container made to manage parallel states of data structures. Give it a callable factory and start unfolding., (*2)

Installation

Friends of terminal: composer require minime/quantum:~0.0 :8ball:, (*3)

Usage

<?php

// Quantum Object looks more expressive when aliased
use Minime\Quantum\Object as Container;

// Quantum needs a callable to produce new states, so let's create one
$Container = (new Container(function(){ return new SomeFancyContainer(); }))

// this is the default environment
->mount('default')->interact(function($container){
    $container->shared('Database', new Database(
        [
            'driver' => 'postgre',
            'host' => 'localhost'
        ]
    ));
    /*...*/
})

// this will be our test/cli environment
->extend('default', 'test')->interact(function($container){
    $container->get('Database')->config(
        [
            'database' => 'app_unit_test',
            'user' => 'foo',
            'password' => 'bar'
        ]
    );
})

// this will be our development environment
->extend('default', 'development')->interact(function($container){
    $container->get('Database')->config(
        [
            'database' => 'app_development',
            'user' => 'bar',
            'password' => 'baz'
        ]
    );
})


// production!
->extend('default', 'production')->interact(function($container){
    $container->get('Database')->config(
        [
            'host' => 'my.production.ip',
            'database' => 'app',
            'user' => 'app',
            'password' => 'P@sW04d'
        ]
    );
});

Switching between states:

<?php

// get test container
$TestContainer  = $Container->mount('test')->expose();

// get development container
$DevelopmentContainer = $Container->mount('development')->expose();

// get production container
$ProductionContainer = $Container->mount('production')->expose();

Interact with all states at once:, (*4)

<?php

$Container->each(function($container){
    // routine
});

Copyright (c) 2013 Márcio Almada. Distributed under the terms of an MIT-style license. See LICENSE for details., (*5)

Bitdeli Badge, (*6)

The Versions

06/12 2013

dev-master

9999999-dev

Quantum is unique kind of container made to manage parallel states of data structures.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

container php collection parallel data type quantum

06/12 2013

dev-develop

dev-develop

Quantum is unique kind of container made to manage parallel states of data structures.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

container php collection parallel data type quantum

06/12 2013

0.0.1

0.0.1.0

Quantum is unique kind of container made to manage parallel states of data structures.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

container php collection parallel data type quantum