PHP code example of regeda / castel

1. Go to this page and download the library: Download regeda/castel 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/ */

    

regeda / castel example snippets


$container = new Castel();

$container->share('foo', 'bar');
$container->share('something', new Something());

$container->foo; // bar
$container->something; // instance of Something class

$container->share('session', function () {
    return new Session();
});

$session = $container->session; // instance of Session class

$container->share('mail', function () {
    return new \Zend_Mail();
});
$container->extend('mail', function ($mail, $container) {
    $mail->setFrom($container->getValue('mail.default_from'));
    return $mail;
});