stevebauman/purify

Call to undefined method Stevebauman\Purify\Purify::getPurifier()

jwittekind opened this issue · 9 comments

Hey there!

I'm currently updating my Laravel Application using Laravel 8 and PHP 7.4.

I just tried to follow you steps for migrating v4 to v5.
Before that i've been working with v3 so far.

After execution of the package update:

composer require stevebauman/purify:^5.0 --with-all-dependencies

I now see this error:

✗ php artisan vendor:publish --provider="Stevebauman\Purify\PurifyServiceProvider"

   Error 

  Call to undefined method Stevebauman\Purify\Purify::getPurifier()

  at vendor/laravel/framework/src/Illuminate/Support/Manager.php:191
    187▕      * @return mixed
    188▕      */
    189▕     public function __call($method, $parameters)
    190▕     {
  ➜ 191▕         return $this->driver()->$method(...$parameters);
    192▕     }
    193▕ }
    194▕ 

      +1 vendor frames 
  2   app/Providers/PurifyServiceProvider.php:27
      Illuminate\Support\Facades\Facade::__callStatic("getPurifier", [])

      +7 vendor frames 
  10  [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(App\Providers\PurifyServiceProvider))

Any idea where this could come from?

Thanks in advance!

I'm experiencing the same? did you manage to fix it?

Hi guys, sorry for the late reply.

Can you post your full stack traces? I can't really see where the method call is coming from, so it could be from your application, or it could be from Purify, but I'm unable to tell.

Thanks!

I had to remove this:

App\Providers\PurifySetupProvider::class

from the providers in config/app.php.

Now, it works.

Oh! Interesting. Did i miss that step when migrating? Not sure whether i should have seen any migration docs.
I'll check, whether that fixes my issue too!

In the installation instruction for v4, it says to add it, but in the migration guide from v4 to v5 it doesn't say to remove it

@michele Are you using Lumen? Manual service provider registration was only intended for Lumen. Purify has always auto-loaded its service provider for Laravel:

If you are using Lumen, you should copy the config file purify.php by hand, and add this line to your bootstrap/app.php:

$app->register(Stevebauman\Purify\PurifyServiceProvider::class);

Closing due to inactivity. Let me know if you still need assistance and I'll re-open this 👍

No need to re-open. I inherited this codebase, so not sure why they added it since we're not using Lumen, sorry I didn't get back to you earlier.

Ok thanks for reporting back! Appreciate it 🙏