Use laravel blade template out side of laravel

Php is a very nice platform and programming langauge for building web application. To build web application we have to build dynamic html using php tags and have to process data. But presenting html is a different construct and processing data is a different construct. So if we would like to separete these both construct in php we have to use template system. Laravel provides awesome template engine but if we do not have to use laravel but it’s blade template engine we can.

We just have to add below dependency in our project composer.json file

Link for laravel blade template php packe: https://packagist.org/packages/philo/laravel-blade

"require":
      {
        "philo/laravel-blade": "3.*"
      },

Than we have to install it via below command

$ > composer install 
or 
$ > composerupdate

Once php package for blade template engine is installed let’s see how we can use it.

Create cache and view folders inside your app directory.

Now let’s create one example template view file inside views directory.

Let’s use this template to show data pass from php.

This is how we can use an awesome laravel blade template engine out side of laravel in php project.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s