1. Go to this page and download the library: Download akram-zaitout/laravel-katex library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use AkramZaitout\LaravelKatex\Services\KatexRenderer;
class MathController extends Controller
{
public function __construct(
protected KatexRenderer $katex
) {}
public function show()
{
$expression = $this->katex->wrapInline('E=mc^2');
return view('math.show', compact('expression'));
}
}