PHP code example of wallaceosmar / carion-framework

1. Go to this page and download the library: Download wallaceosmar/carion-framework library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wallaceosmar / carion-framework example snippets




$carion->example = 'example';

$carion['example2'] = 'example2';

echo $cation->example;
echo $carion['example2'];



$carion = new Carion\Carion();

$carion->singleton( 'example', function () {
    return 'example';
});

echo $carion->example;


$carion = new Carion\Carion();

$carion->set('value', 'example');

$carion->singleton( 'example', function ( $value ) {
    return $value;
});

echo $carion->example;


$carion = new Carion\Carion();

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

echo $carion->example;

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

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