Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autoloading classes from my private repository included in Composer

I've added my own repository to a Composer, it download properly into my another project. Unfortunately Composer doesn't take my repository code under consideration while updating autoloading.

autoload_namespaces.php has many namespaces generated but any of them is my repository code. I could add namespaces in my "autoloading" section in composer.json or I could also add it in PHP using Autoloader9287463497853476 object but those solutions (ideologically equal) doesn't interest me.

How can I force my Composer to generate autoloading for my repository code also?

like image 893
lilly Avatar asked Jan 29 '26 20:01

lilly


1 Answers

If you add your package using the repository section of composer.json, i would sugest you to include there the code for autoload, as i used here:

"repositories": [  
 {
      {
            "type": "package",
            "package": {
                "name": "brand/name",
                "type": "library",
                "version": "1.0.0",
                "dist": {
                    "url": "file:///path-to-file.zip",
                    "type": "zip",
                    "reference": "XXXX"
                },
                "autoload": {"psr-0": { "Name\\Space\\": "dest-folder" }
            },
      }            
}

I hope it helps.

like image 134
Ariel C. Avatar answered Jan 31 '26 16:01

Ariel C.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!