javascript - How can I call npm module from PHP class -


i found javascript plugin convert html markdown here https://github.com/domchristie/to-markdown.

i'm using laravel 5. let's user post html string , take request php class. here's controller:

<?php     class thecontroller extends controller     {         ...         public function index()         {             $html_text = request::input('html_text');             // convert $html_text $markdown         }     } ?> 

if in javascript file could've called function this:

var tomarkdown = require('to-markdown'); tomarkdown('<h1>hello world!</h1>'); 

how convert $html_text $markdown without converting text file , read it, if possible

you shouldn't use npm package that, there plenty php packages this. can find lot of packages compatible laravel on packalyst.

for example: http://packalyst.com/packages/package/alfredo-ramos/parsedown-extra-laravel


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -