aminos/codeigniter-blade

Codeigniter blade template engine

v1.0.0 2023-12-15 15:05 UTC

This package is auto-updated.

Last update: 2024-04-15 15:49:33 UTC


README

Installation

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

composer require aminos/codeigniter-blade

Or, install manually by downloading the source files and adding the directory to app/Config/Autoload.php.

Usage (Helper function)

<?php

class Home extends BaseController {
    public function index() {
        /** load blade helper function */
        helper('blade');
        
        /*
         * create {view_name}.blade.php inside Views folder
         */
        $data = ['key' => 'value'];
        
        return blade('view_name', $data);
    }
}

Usage (service)

<?php

class Home extends BaseController {
    public function index() {
        /** load blade service */
        $blade = \Config\Services::blade(); // or service('blade')
        
        /*
         * create {view_name}.blade.php inside Views folder
         */
        $data = ['key' => 'value'];
        
        return $blade->render('view_name', $data);
    }
}

Blade Documentation

Larvel Blade Templates Docs