PHP code example of htmlburger / wpemerge-blade

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

    

htmlburger / wpemerge-blade example snippets


    \App::make()->bootstrap( [
        'providers' => [
            \WPEmergeBlade\View\ServiceProvider::class,
        ],
    ] );
    

[
    // Automatically replace the default view engine for WP Emerge.
    'replace_default_engine' => true,

    // Pass .php views to the default view engine.
    // replace_default_engine must be true for this to take effect.
    'proxy_php_views' => true,

    // Filter core theme templates to search for .blade.php files.
    // This is only necessary in themes.
    'filter_core_templates' => false,

    // Options passed directly to Blade.
    'options' => [
        // 'views' defaults to the main ['views'] key of the configuration.
        'views' => [get_stylesheet_directory(), get_template_directory()],
        // 'cache' defaults to the main ['cache']['path'] key of the configuration.
        'cache' => 'wp-content/uploads/wpemerge/cache/blade',
    ],
]

\App::make()->bootstrap( [
    // ... other WP Emerge options
    'blade' => [
        // ... other WP Emerge Blade options
        'options' => [
            // ... other Blade options
            'cache' => get_stylesheet_directory() . DIRECTORY_SEPARATOR . 'blade-cache',
        ],
    ],
] );

// \App::resolve() used for brevity's sake - use a Service Provider instead.
$blade = \App::resolve( WPEMERGEBLADE_VIEW_BLADE_VIEW_ENGINE_KEY );
$blade->compiler()->directive( 'mydirective', function( $expression ) {
    return " echo 'MyDirective: ' . $expression . '!';