4

I am going to use michelf/php-markdown package in my Laravel 5.2 application.
To install this package I added "michelf/php-markdown": "~1.6.0" to composer.json file and then I ran composer update command.
After this, I changed app.php file and added Michelf\Markdown::class to Providers array and 'Markdown' => Michelf\Markdown::class to aliases array.

But when I want to use this class:

public function store($request)
{
    $title = $request->title;
    $text= $request->text;
    $transformedText = Markdown::defaultTransform($text);
    dd($transformedQuestion);
}

I face this error:

FatalErrorException in C:\wamp\www\projects\stackoverflow\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php line 119:  

Call to undefined method Michelf\Markdown::isDeferred()

Is my way to install a package in Laravel wrong?

2 Answers2

8

I think it was my misunderstand about providers in Laravel.
I removedMichelf\Markdown::class from Providers array in app.php file and it worked.

0

I had the same issue while using inertiajs with Laravel 8 and I noticed that I had added this \App\Http\Middleware\HandleInertiaRequests::class, into providers array in config/app.php which needs to be added in Http/Kernel.php $middlewareGroups array. Once I did that it fixed the issue.

Ismail
  • 331
  • 3
  • 10