ronon
5 months ago

Load local package through composer

Posted 5 months ago by ronon

I want to include a local package for omnipay but I struggle to find out how to do that.

I use laravel so I created a folder app\PaymentPlugins\nameofpaymentprovider

Inside app\PaymentPlugins\nameofpaymentprovider i created a composer.json file

{
    "name": "paymentplugins/nameofpaymentprovider",
    "type": "library",
    "description": "nameofpaymentprovider driver for the Omnipay payment processing library",
    "autoload": {
        "psr-4": { "Omnipay\Nameofpaymentprovider\" : "src/" }
    },
    "require": {
        "omnipay/common": "^3"
    },
    "require-dev": {
        "omnipay/tests": "^3",
        "squizlabs/php_codesniffer": "^3",
        "phpro/grumphp": "^0.14"
    },
    "extra": {
    },
    "prefer-stable": true
}

I also updated the main composer.json to

 "autoload": {
        "psr-4": {
            "App\": "app/",
            "App\PaymentPlugins\nameofpaymentprovider\": "src/"
        },
    },
    "repositories": [
        {
            "type": "path",
            "url": "app/PaymentPlugins/nameofpaymentprovider"
        }
    ],

But its not recognised. So what am I missing?

Nevermind, had some namespacing issues.

Please sign in or create an account to participate in this conversation.