3

I'm using codeigniter framework but I want to use features of laravel framework like below code that I can print a variable without <?php echo $name ?> :

Hello {{ $name }}

How can I do ?

3 Answers 3

4

Codeigniter is an Php Framework. And Laravel is also php framework too. And this both is not equal with each other. As simple

Codeigniter(<4.0) != Laravel

Take look at Laravel vs. CodeIgniter

Laravel vs. Codeigniter

    Module               Laravel                Codeigniter
----------------------------------------------------------
Layout Control              Yes                         No
ORM                         Yes                         No
Error Stack Trace           Yes                         No
Class Auto Loading          Yes                         Yes
–Database mySQL             Yes                         Yes
–Database SQLite            Yes                         Yes
–Database MSSQL             Yes                         Yes
–Database PostgreSQL        Yes                         Yes
–Database Cubrid            Yes                         Yes
–ODBC drivers               Yes                         No
–Database MariaDB           No                          No
Authentication Library      Yes                         No
External Modules            Yes                         Yes
Form Validation Rules       Yes                         Yes
Internationalization        Yes                         Yes
Database Module             Object-oriented             Hybrid Object-relational
Template language           Blade Template Engine       Blade php Proprietary
Design pattern              Active-Record               Active-Record
                            Model-View-Controller       Model-View-Controller
                            Dependency injection
                            Observer
                            Singleton
                            Event-Driven
                            MTV
                            Factory
                            RESTfull
                            Facade

So some open source library's can use with both of this frameworks but not all(phpMailer, phpExcel..)

8
  • @Drudge Codeigniter not having feature call ORM. when you use symfony or laravel you can identify diff. Jan 15, 2016 at 11:18
  • @Abdulla which of them u are using ? Jan 15, 2016 at 11:20
  • @S.M_Emamian i know using CI is bit tough for coding. But can learn lot more than you expected. Jan 15, 2016 at 11:21
  • 1
    @S.M_Emamian happy to help you :) Jan 15, 2016 at 11:24
  • Codeigniter does support bundles as of 3.X since it works with composer, With composer you can download bundles.
    – killstreet
    Jan 15, 2016 at 14:24
0

Yes! you can use blade template engine and use some laravel syntax {{$Data}} like this.....

1 allow vendor 2 install blade package 3 use it

1
  • 1
    Welcome to SO! Please be more specific about the answer. Jul 10, 2021 at 17:56
0

You can use BladeView library for CI.

class Welcome extends CI_Controller {
  public function __construct() {
    parent::__construct();
    $this->load->library("bladeview");
  }

 public function renderView(){
    $data=array(
            "name"=>"Jhon",
            "age"=>21
        );
    $this->bladeview->render("test", $data);
 }

 public function renderString(){
    $data=array(
            "name"=>"Jhon",
            "age"=>21
        );
    $string="Hello I'm \{{$name}}. My age is \{{$age}}";
    $this->bladeview->render($string, $data,false);
  }
}

then in view.blade.php you can render like you do in laravel blade.

Hello my name is {{$name}}. My Age is {{$age}}.

Output:

Hello my name is Jhon. My Age is 21.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.