Closed vHeemstra closed 1 year ago
Hello @vHeemstra,
how did you attempt to access the Mollie facade exactly? After requiring this package with composer require mollie/laravel-mollie
you should see the package listed in the Discovering Packages Info (s. screenshot). Afterwards you should be able to access it by calling Mollie::api()->…
.
I followed the steps as described in the readme. This is the log from re-running this command:
In my controller I include the class references:
use Mollie\Laravel\Facades\Mollie;
use Mollie\Api\Exceptions\ApiException;
And inside the controller method (that handles a page request) I use this to get the available payment methods:
try {
$mollieMethods = Mollie::api()->methods()->allActive([
'sequenceType' => 'oneoff',
'amount' => [
'currency' => 'EUR',
'value' => number_format((float) $payment->total, 2, '.', ''),
],
'include' => 'issuers',
]);
} catch (ApiException $e) {
report($e);
}
Did some additional testing. The autoload works out-of-the-box on my local dev, but the above mentioned error is thrown on my online test environment. Although I did update the vendors
folder and composer.*
files, I might missed something Laravel-related there. (Probably the Laravel cache files.)
Anyway, the issue is with my composer update online I think and not with this package. 😄
@vHeemstra, yes you have to delete the cache in order for this to work. Otherwise it won’t pick up on newly registered packages I think
I'm not sure what changed, but in a new, default, Laravel (v9) application, the documented method of including this package results in Laravel not able to find the facade class:
Adding
Mollie\Laravel\MollieServiceProvider::class,
to theproviders
key of the array returned byconfig/app.php
, fixed this.Maybe the docs need updating or the package itself (if this step should not be needed).
https://github.com/mollie/laravel-mollie/blob/039eec4f8e8a138e0539d77e0dcce3bc34df25f8/README.md?plain=1#L51
Tested with: