1. Go to this page and download the library: Download pinkcrab/bladeone-engine 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/ */
pinkcrab / bladeone-engine example snippets
// Bootstrap for Perique follows as normal..
$app = ( new App_Factory('path/to/project/root') )
->default_config()
->module(BladeOne::class)
// Rest of setup
->boot();
class Some_Class {
public function __construct( View $view ) {
$this->view = $view;
}
public function render_view() {
return $this->view->render('some.path.view_name', ['data' => 'to pass']);
}
}
// Bootstrap for Perique follows as normal..
$app = ( new App_Factory('path/to/project/root') )
->default_config()
->module(BladeOne::class, function( BladeOne $blade ) {
// Module config.
$blade
->template_path('path/to/custom/views')
->compiled_path('path/to/custom/cache'); // Fluent API for chaining.
$blade->mode( BladeOne::MODE_DEBUG );
// BladeOne_Engine config.
$blade->config( function( BladeOne_Engine $engine {
// See all methods below.
$engine
->set_compiled_extension('.php')
->directive('test', fn($e) =>'test'); // Fluent API for chaining.
$engine->allow_pipe( false );
});
// Ensure you return the instance.
return $blade;
})
// Rest of setup
->boot();
/** Some Class */
class BladeOneConfig {
public function __invoke( BladeOne $blade ): BladeOne {
return $blade
// The setup.
}
}
$app = ( new App_Factory('path/to/project/root') )
->default_config()
->module(BladeOne::class, new BladeOneConfig() )
->boot();
// None static
$this->view->engine()->some_method($data);
// As static
BladeOne_Engine::some_method($data);
{$this->some_method($data)}
// Or
{BladeOne_Engine::some_method($data)}
// Using the App's View method to access none static methods on the fly.
App::view()->engine()->some_method($data);