1
"name": "foostart/sample",
"type": "library",
"description": "Create overview sample can intergrate other project",
"keywords": ["package","package"],
"homepage": "https://github.com/InfinitePW/Foostart",
"license": "MIT",
"authors": [
    {
        "name": "Foostart",
        "email": "nguyenanhhoanld@gmail.com",
        "role": "Developer"
    }
],
"minimum-stability": "stable",
 "require": {
    "php": ">=5.3.0"
},
"autoload": {
    "psr-4": {
        "Sample": "src"
    }
}

When i submit package from GitHub to Packagist.org. I have a problem with "composer.json". How can i fix it?? Thanks. https://github.com/InfinitePW/Foostart

IMc
  • 41
  • 1
  • 4
  • It looks like you've resolved this problem. https://packagist.org/packages/foostart/sample – Eric Poe Feb 24 '17 at 20:53
  • Oh. That's not my project. I'm student. At school, each group will upload same project to GitHub and Packagist. This's my project https://packagist.org/packages/foostartnd/sample – IMc Feb 25 '17 at 03:58
  • I resolved my problem. :) I just move composer.json out of project folder. This's same level with project folder. Go to my project https://github.com/InfinityM/Foostart – IMc Feb 25 '17 at 04:01

1 Answers1

2

I'm adding this as an answer so that others can benefit:

composer.json needs to be in the root of your git project in order for other projects, including packagist.org, to take advantage of it.

Eric Poe
  • 383
  • 2
  • 9
  • This is crazy. So the composer dependency management system is so stupid that it is not able to find a composer.json file that is somewhere inside the repo? What if my repo contains different projects, and the composer.json file is inside some sub folder? I cannot change this. – Jaume Mussons Abad May 09 '18 at 19:05
  • @JaumeMussonsAbad, if you do a search for `composer.json` within almost any medium-to-large-sized project, you will most likely find multiple examples of that file; however, all but one will be in the `vendor` directory, whereas that project's `composer.json` is in that project's root directory. The magic of Composer is that it can tie disparate projects together. So if you have multiple projects with their own git structure, each should have their own `composer.json` & your main project's `composer.json` would reference those in its "requires" or "requires-dev" sections. – Eric Poe May 29 '18 at 17:58
  • Coming from the wonderful world of node and npm, I am sorry to say this, but, composer is pure crap. Even so there's no better alternative, so ... – Jaume Mussons Abad May 30 '18 at 06:13