2017 © Pedro Peláez
 

library carion-framework

A basic singleton registry manager.

image

wallaceosmar/carion-framework

A basic singleton registry manager.

  • Monday, June 11, 2018
  • by wallaceosmar
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Carion-Framework

Carion is a simple singleton manager framework., (*1)

Installing

composer require wallaceosmar/carion-framework

How Use

The access of the values can be due to a object value or array access., (*2)


require_once './vendor/autoload.php'; $carion->example = 'example'; $carion['example2'] = 'example2'; echo $cation->example; echo $carion['example2'];

Seting a singleton

Singleton is used to call some functions or instantiate custom class., (*3)

Setting a singleton to be used later


$carion = new Carion\Carion(); $carion->singleton( 'example', function () { return 'example'; }); echo $carion->example;

Setting a singleton with parameter

The function singleton map the names of the paramter to a singleton register in the class., (*4)


$carion = new Carion\Carion(); $carion->set('value', 'example'); $carion->singleton( 'example', function ( $value ) { return $value; }); echo $carion->example;

If the does`t have a value to the paramter, will be seted null as the value., (*5)


$carion = new Carion\Carion(); $carion->singleton( 'example', function ( $value ) { if ( 'example' == $value ) { $value = md5( $value )'; } return $value; }); echo $carion->example;

Calling a function or class method

You can call a function or a class method using the function call., (*6)

The function call is reponsibly to map all the paramters., (*7)

echo $carion->call(function( $value1, $value2 ) {
    return $value1 + $value2;
}, array( 10, 20 ));

Parsing a array with key name overwrite the order of values., (*8)

echo $carion->call(function( $value1, $value2 ) {
    return $value1 + $value2;
}, array( 10, 20, 'value1' => 0 ));

The Versions

11/06 2018

dev-master

9999999-dev

A basic singleton registry manager.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Wallace Osmar

manage registry singleton