Question

I'm trying to integrate the Omnipay Paypal package with my Laravel 4.1 application. I've installed the laravel-omnipay package, as suggested by Omnipay, and followed the instructions on how to set it up.

I've added the laravel-omnipay package to both the providers array and the aliases array in the app.php file of Laravel. The config file has also been created.

My composer.json has the following requirements:

"ignited/laravel-omnipay": "1.*",
"omnipay/paypal": "~2.0"

and the config file of ignited/laravel-omnipay looks like this:

<?php

return array(

    // The default gateway to use
    'default' => 'paypal',

    // Add in each gateway here
    'gateways' => array(
        'paypal' => array(
            'driver' => 'Paypal_Express',
            'options' => array(
                'solutionType' => '',
                'landingPage' => '',
                'headerImageUrl' => ''
            )
        )
    )
);

But when I call $gateway = Omnipay::gateway('paypal'); I'm getting the error

Class '\Omnipay\Paypal\ExpressGateway' not found"

Is there something I'm forgetting? :I

Was it helpful?

Solution

I'm not familiar with ignited/laravel-omnipay specifically, so this may or may not be the problem, but you might try fixing the capitalisation on this line:

'driver' => 'PayPal_Express',

(note that PayPal has two capital P's).

Generally class names are not case sensitive in PHP, but if you are using a case-sensitive filesystem, then the composer autoloader will not be able to find the right class.

OTHER TIPS

Try composer dumpautoload to load new classes.

UPDATE:

Think in a term of service that is provided to your application by that new package. Find where is that service linked to application. It is usually done through ServiceProviders class. If there is no bug, it should be easy, following simple business rule to see how is provider related to main app. So, you have one entity (provider) that should communicate with another. That communication is done through simple rules. This is the best way to learn Laravel. It helps to think in a term of business rules, rather then to stare at code which is often very abstract.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top