composer-phppackagist

Can I place the composer.json file for my project not on the root directory?


I am implementing a project that I want to share via Packagist. Usually, the composer.json file would be in the project root directory, but I want to have all the composer-related files and directories under the subdirectory /private/composer. After moving composer.json, composer.lock and vendor, Packagist is not able to find the composer.json on my remote repository, so my project will not auto-update anymore.

Is it possible to do what I want and still have Packagist auto-updating the project?

The project structure I want to achieve is like this:

.
├── .editorconfig
├── .git
│   ├── branches
│   ...
├── .gitignore
├── .htaccess
├── license.txt
├── private
│   ├── composer
│   │   ├── composer.json
│   │   ├── composer.lock
│   │   └── vendor
│   │       ├── autoload.php
│   │       ...
│   ├── npm
│   │   ├── package.json
│   │   ├── package-lock.json
│   │   └── node_modules
│   │       ...
├── public
│   └── index.php
└── readme.md

Solution

  • No, it is not possible.

    Moreover, even if it was possible, I would not recommend it - this is unusual configuration and it would only confuse users of your package.