Search code examples
phpcomposer-php

Your package name is invalid - Composer 2.0


I'm trying to composer-install and I get the following error Your package name access-nyc is invalid, it should have a vendor name, a forward slash, and a package name. I have the following in my package name:

{
  "name": "access-nyc",
  "version": "3.8.1",
  "description": "Find help in NYC with food, money, housing, work and more on ACCESS NYC",
  "homepage": "https://access.nyc.gov",
  "authors": [
    {
      "name": "NYC Opportunity",
      "email": "products@nycopportunity.nyc.gov",
      "homepage": "http://nyc.gov/opportunity"
    },
    {
      "name": "Blue State Digital",
      "homepage": "https://www.bluestatedigital.com"
    }
  ],
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    }
  ],

This is the package name that breaks, "access-nyc" but to me it looks good. What is the problem?


Solution

  • The issue here is in the error message. Composer packages have an organisation and a package name, so multiple packages can be grouped together by creator. For example, a valid package name of mine is SilverJPreece/phing-vagrant.

    Any package I create personally will share the same organisational prefix.