Yii Framework Forum

Class 'Michelf\MarkdownExtra' not found

(jaaf) #1

Generally I use the kartik-v markdown extra extension with no problem. This time I am facing this message :

Class ‘Michelf\MarkdwonExtra’ not found

This happens only on my webhosting, not on my local version and don’t see what to check. I uploaded the vendor/kartk-v and vendor/michelf twice but nothing changes.
I have the module declared in the config with

‘modules’ =>
‘admin’ => [ ‘class’ => ‘app\modules\admin\Admin’,],
‘markdown’ => [ ‘class’ => ‘kartik\markdown\Module’,],

and the class declared in the wiew that triggers the error.

use Michelf\MarkdownExtra;

What else should I check?

(Henry Volkmer) #2

First things first: The krajee-markdown-editor do not depends on Michelf\MarkdownExtra. You don’t need MarkdownExtra to run krajee-markdown-editor.

Anyways, it seems you did not installed Michelf\MarkdownExtra. Try to install it via

composer require michelf/php-markdown

(jaaf) #3

Hi, thank you for your answer,
I wasn’t trying to use the editor : only the markdown to html converter.
In my opinion the editor is not necessary as it does very little work.
I used composer with

“kartik-v/yii2-markdown”: “dev-master”,

in the composer.json file
The composer update command automatically added 2 folders in vendors : kartik-v and michelf
I didn’t used the Krajee recommendation probably using some old recommendation. In fact both worked and still work locally:

use kartik\markdown\Markdown;
echo Markdown::convert($content); 

and second

use Michelf\MarkdownExtra;
$parser = new MarkdownExtra();
                echo $parser->transform($postlang_model->content);

but none of them worked on the hosting.
In fact this was probably due to an incomplete uploading of vendors as re-doing the upload several times, I finally get it working.