<p>Adding <code>kgrote/siteutilities</code> to your "require" section in your main composer file then changing your "name" in the plugin composer file to match should help.</p>

<p>Don't forget to update the plugin version number to try to force composer top get the latest versions. I've found it caches in the Vendors directory though. So make the above changes and delete the composer.lock file and the Vendors directory and install everything from scratch.</p>

CC BY-SA 4.0
2018-09-10T10:41:29.567Z
2018-09-10T10:41:29.567Z
Jay
<p>From looking at your plugin's <code>composer.json</code> file, I think you've got the package name wrong – instead of</p>

<pre><code>composer require kgrote/siteutilities
</code></pre>

<p>you'll probably want</p>

<pre><code>composer require kgrote/site-utilities
</code></pre>

<p>I.e. the plugin folder's name doesn't matter – it's the <code>name</code> entry in your plugin's <code>composer.json</code> file that determines the package name.</p>

CC BY-SA 4.0
2018-09-13T19:23:27.067Z
That was the problem, thanks! Also explains how composer knows what the package name is.
kmgdev
CC BY-SA 4.0
2018-09-10T05:15:19.793Z
2018-09-10T05:15:19.793Z
Mats Mikkel Rummelhoff
<p>I set up a basic plugin using <a href="https://pluginfactory.io/" rel="nofollow noreferrer">https://pluginfactory.io/</a></p>

<p>The package name is <code>kgrote</code></p>

<p>The plugin name is <code>siteutilities</code></p>

<p>Then I put it in a subfolder next to my Craft project folder:</p>

<pre><code>/site
|-- craft
|-- craft-plugins
  |-- kgrote
    |-- siteutilities
</code></pre>

<p>Then I added this to <code>craft/composer.json</code>:</p>

<pre><code>"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [
    {
      "type": "path",
      "url": "../craft-plugins/kgrote/siteutilities"
    }
]
</code></pre>

<p>Then I ran this command in the Craft project folder: </p>

<p><code>composer require kgrote/siteutilities</code></p>

<p>Then I got this error:</p>

<blockquote>
  <p>Could not find a matching version of package kgrote/siteutilities.
  Check the package spelling, your version constraint and that the
  package is available in a stability which matches your
  minimum-stability (stable).</p>
</blockquote>

<p>Here is the contents of my <code>craft/composer.json</code> file:</p>

<pre><code>{
  "require": {
    "craftcms/cms": "3.0.23.1",
    "vlucas/phpdotenv": "^2.4.0",
    "craftcms/aws-s3": "1.0.8",
    "craftcms/redactor": "2.1.6",
    "ether/seo": "3.4.3"
  },
  "autoload": {
    "psr-4": {
      "modules\\": "modules/"
    }
  },
  "config": {
    "optimize-autoloader": true,
    "platform": {
      "php": "7.0"
    }
  },
  "scripts": {
    "post-root-package-install": [
      "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ]
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "repositories": [
    {
      "type": "path",
      "url": "../craft-plugins/kgrote/siteutilities"
    }
  ]
}
</code></pre>

<p>And here is the contents of my plugin <code>composer.json</code> file:</p>

<pre><code>{
    "name": "kgrote/site-utilities",
    "description": "Helper functions for this website.",
    "type": "craft-plugin",
    "version": "1.0.0",
    "keywords": [
        "craft",
        "cms",
        "craftcms",
        "craft-plugin",
        "site utilities"
    ],
    "support": {
        "docs": "???",
        "issues": "???"
    },
    "license": "MIT",
    "authors": [
        {
            "name": "Kristen Grote"
        }
    ],
    "require": {
        "craftcms/cms": "^3.0.0-RC1"
    },
    "autoload": {
        "psr-4": {
          "kgrote\\siteutilities\\": "src/"
        }
    },
    "extra": {
        "name": "Site Utilities",
        "handle": "site-utilities",
        "hasCpSettings": false,
        "hasCpSection": false,
        "changelogUrl": "???",
        "class": "kgrote\\siteutilities\\SiteUtilities"
    }
}
</code></pre>

<p>Don't really know what I'm doing wrong here. How does composer know what <code>kgrote/siteutilities</code> is if it's not defined in the <code>composer.json</code> file? Shouldn't that be part of the <code>"repositories"</code> config setting?</p>

CC BY-SA 4.0
2018-09-09T08:48:11.337Z
You may need to paste your composer file for the plugin itself and your full project composer file to help us work out exactly what the problem is. In the past I’ve had to delete my vendors directory and composer lock file to force composer to fetch everything fresh.
Jay
CC BY-SA 4.0
2018-09-10T00:44:04.007Z
@Jay Updated with `composer.json` files.
kmgdev
<plugins><composer>
Can't Install Plugin Via Composer
# Can't Install Plugin Via Composer

(Asked by: username_0 on 2018-09-08)

I set up a basic plugin using https://pluginfactory.io/
The package name is kgrote
The plugin name is siteutilities
Then I put it in a subfolder next to my Craft project folder:
/site
|-- craft
|-- craft-plugins
  |-- kgrote
    |-- siteutilities

Then I added this to craft/composer.json:
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [
    {
      "type": "path",
      "url": "../craft-plugins/kgrote/siteutilities"
    }
]

Then I ran this command in the Craft project folder: 
composer require kgrote/siteutilities
Then I got this error:

Could not find a matching version of package kgrote/siteutilities.
  Check the package spelling, your version constraint and that the
  package is available in a stability which matches your
  minimum-stability (stable).

Here is the contents of my craft/composer.json file:
{
  "require": {
    "craftcms/cms": "3.0.23.1",
    "vlucas/phpdotenv": "^2.4.0",
    "craftcms/aws-s3": "1.0.8",
    "craftcms/redactor": "2.1.6",
    "ether/seo": "3.4.3"
  },
  "autoload": {
    "psr-4": {
      "modules\\": "modules/"
    }
  },
  "config": {
    "optimize-autoloader": true,
    "platform": {
      "php": "7.0"
    }
  },
  "scripts": {
    "post-root-package-install": [
      "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ]
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "repositories": [
    {
      "type": "path",
      "url": "../craft-plugins/kgrote/siteutilities"
    }
  ]
}

And here is the contents of my plugin composer.json file:
{
    "name": "kgrote/site-utilities",
    "description": "Helper functions for this website.",
    "type": "craft-plugin",
    "version": "1.0.0",
    "keywords": [
        "craft",
        "cms",
        "craftcms",
        "craft-plugin",
        "site utilities"
    ],
    "support": {
        "docs": "???",
        "issues": "???"
    },
    "license": "MIT",
    "authors": [
        {
            "name": "Kristen Grote"
        }
    ],
    "require": {
        "craftcms/cms": "^3.0.0-RC1"
    },
    "autoload": {
        "psr-4": {
          "kgrote\\siteutilities\\": "src/"
        }
    },
    "extra": {
        "name": "Site Utilities",
        "handle": "site-utilities",
        "hasCpSettings": false,
        "hasCpSection": false,
        "changelogUrl": "???",
        "class": "kgrote\\siteutilities\\SiteUtilities"
    }
}

Don't really know what I'm doing wrong here. How does composer know what kgrote/siteutilities is if it's not defined in the composer.json file? Shouldn't that be part of the "repositories" config setting?

**Tags:** plugins, composer
> **Comments:**
> **username_1**: You may need to paste your composer file for the plugin itself and your full project composer file to help us work out exactly what the problem is. In the past I’ve had to delete my vendors directory and composer lock file to force composer to fetch everything fresh.  
> **username_0**: @Jay Updated with `composer.json` files.  

---

## 2 answers

### Answer by username_2 on 2018-09-10. Score: 5 | Accepted answer

From looking at your plugin's composer.json file, I think you've got the package name wrong – instead of
composer require kgrote/siteutilities

you'll probably want
composer require kgrote/site-utilities

I.e. the plugin folder's name doesn't matter – it's the name entry in your plugin's composer.json file that determines the package name.

> **Comments:**
> **username_0**: That was the problem, thanks! Also explains how composer knows what the package name is.  

---

### Answer by username_1 on 2018-09-10. Score: 1

Adding `kgrote/siteutilities` to your "require" section in your main composer file then changing your "name" in the plugin composer file to match should help.

Don't forget to update the plugin version number to try to force composer top get the latest versions. I've found it caches in the Vendors directory though. So make the above changes and delete the composer.lock file and the Vendors directory and install everything from scratch.


---

