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?
composer.json
files.