bschmitt / laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages
MIT License
268 stars 86 forks source link

Target class [Amqp] does not exist. #109

Closed ThaDaVos closed 2 years ago

ThaDaVos commented 2 years ago

I am trying to use this package in my custom package - I am using Orchestral Testbench for testing it, but for some reason the facade from this package won't load... I've setup the following according to your docs but still no luck:

    /**
     * Get the service providers for the package.
     *
     * @param  \Illuminate\Foundation\Application  $app
     * @return array
     */
    protected function getPackageProviders($app)
    {
        return array_merge(
            parent::getPackageProviders($app),
            [
                'Spatie\LaravelRay\RayServiceProvider',
                'Muntz\LaravelAmqpEvents\LaravelAmqpEventsServiceProvider',
                'Bschmitt\Amqp\AmqpServiceProvider',
            ]
        );
    }

    /**
     * Get the aliases for the package.
     *
     * @param  \Illuminate\Foundation\Application  $app
     * @return array
     */
    protected function getPackageAliases($app)
    {
        return array_replace(
            parent::getPackageAliases($app),
            [
                'Amqp' => 'Bschmitt\Amqp\Facades\Amqp',
            ]
        );
    }

Just a note: the other packages I use just work fine, without any issues - serviceprovider from this package seems to be loaded so...

ThaDaVos commented 2 years ago

Fixed my issue.... I borrowed code from how Laravel Horizon does stuff and forgot... it doesn't load the serviceproviders by itself...