PHP code example of cable / cable-view

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

    

cable / cable-view example snippets

 

$container = \Cable\Container\Factory::create();
$container->singleton(
    \Cable\Config\Config::class,
    function () {
        return new Cable\Config\Config(
            array(
                'view' => [
                    'path' => 'view/',
                    'cache' => 'cache/',
                ],
            )
        );
    }
);

$container->addProvider(\Cable\View\ViewServiceProvider::class);



 


$blade = $container->make(\Cable\View\BladeDriverInterface::class);

echo $blade->make('index', array(
    'test' => 'hello world' 
     ));

 
 $container->addProvider(\Cable\View\TwigServiceProvider::class);
 
 $twig = $twig->with('test', 'hello world')
              ->make('index.html');