Composer Not Generating Autoloads For Library

前端 未结 3 1992
隐瞒了意图╮
隐瞒了意图╮ 2021-01-11 10:51

I\'ve set up two projects, an \'init\' and a library, which is required by the init. They both have PSR-0 autoloads set, but the autoload values from the library are not add

相关标签:
3条回答
  • 2021-01-11 11:27

    Try composer dump-autoload command.

    0 讨论(0)
  • 2021-01-11 11:51

    It depends how you installing your library via Composer. For example, when downloading it as package type (same I believe with composer type), Composer never reads the composer.json file, so instead you should use vcs or git type. See: GH-6846.

    Here is composer.json which should work:

    {
      "require": {
        "lxp/library": "dev-master"
      },
      "repositories": [
        {
          "type": "vcs",
          "url": "http://satis.repo.redacted/"
        }
      ]
    }
    

    Then run: composer install.

    For troubleshooting, try running:

    • composer dump-autoload -o -vvv.
    • composer diagnose -vvv
    0 讨论(0)
  • 2021-01-11 11:53

    I see two possible mistakes you may have done that would cause this:

    • You forgot to update your satis repo so the autoload config for lxp/init is not up to date in there
    • You are running composer install from a lock file, and that means composer just reads the info from the composer.lock file and does not update package metadata to the latest version available in satis. To solve this you should run composer update instead.
    0 讨论(0)
提交回复
热议问题