1
votes

I'm create composer package with type library. And trying to require it to Symfony2 project.

The package has following composer.json

{
    "name": "vendor/package-sdk",
    "description": "My private package",
    "type": "library",
    "license": "MIT",
    "autoload": {
        "psr-4": {"Vendor\\PackageSDK\\": "src/"}
    },
    "require": {
        "php": ">=5.3.3"
    }
}

Then I require it to my SF2 project.

"repositories": [
    {
        "type": "git",
        "url": "[email protected]:me/vendor-package-sdk.git"
    },
],
"require": {
    ...
    "vendor/package-sdk": "~0.0.1-alpha1"
    ...
}

When I calling

use Vendor\PackageSDK\Client;

...

$client = new Client();

```

And I got fatal error:

PHP Fatal error:  Class 'Vendor\PackageSDK\Client' not found in /path

If I do

composer dump-autoload -o

It works, but

composer dump-autoload

not.

The file vendor/composer/autoload_psr4.php contain:

'Vendor\\PackageSDK\\' => array($vendorDir . '/vendor/package-sdk/src'),

Could anybody tell me what am I doing wrong?

1
Quick glance on mobile it looks like you have the wrong name call..? package - sdk vs packageSDK,izk

1 Answers

-1
votes

In composer autoload_classmap.php file I saw the following line

'Vendor\PackageSDK\Client' => $vendorDir . '/vendor/package-sdk/src/Cilent.php',

So it's just a typo in filename of package

Cilent.php should be Client.php