简体   繁体   中英

How to use blade template in slim php framework

I am using Slim 3 PHP framework. I know laravel 5.2.So I want to integrate Blade Template in my slim php framework.Can anyone suggest me best way to integrate blade template in slim framework using composer.What should I place in composer.json in require section????

One way to use Laravel's components outside of Laravel is to look at Torch .

See their view component for how to use Blade.

If you're not wedded to Blade, then look at Twig , as the Slim project maintains a component called Twig-View to integrate Twig into Slim.

You can't use Laravel's blade and view outside the framework directly. Extracting those and making it work outside in another framework can be tiresome. You might want to check out these packages who do it for you and provide the functionality.

https://github.com/duncan3dc/blade

https://github.com/PhiloNL/Laravel-Blade

https://github.com/EFTEC/BladeOne

You can also try Twig which is a popular templating engine for PHP and the syntax is almost similar.

https://twig.sensiolabs.org/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM