PHP code example of ensphere / container

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

    

ensphere / container example snippets


Ensphere\Container\Providers\ServiceProvider::class

Ensphere\Container\Http\Middleware\Validate::class

$container = $app['ensphere.container'];
$container->register( 'dashboard-top-bar' )

use Ensphere\Container\Content;
use Illuminate\Http\Request;

class Stub extends Content {

	/**
	 * the view to be rendered in said area
	 * @var string
	 */
	protected $view = 'views.view';

	/**
	 * Validates pass instance of Validator back to the container to validate this section.
	 * @param  Request $request - Illuminate\Http\Request
	 * @return Instance of Illuminate\Contracts\Validation\Validator
	 */
	public function validate( Request $request  )
	{

	}

	/**
	 * called once all validation has passed from other areas.
	 * @param  Request $request - Illuminate\Http\Request
	 * @return NULL
	 */
	public function process( Request $request )
	{

	}

}

$container->bind( 'dashboard-top-bar', [
	Namespace\To\Your\Stub::class
]);

$topBar = $container->render( 'dashboard-top-bar' );