I have a laravel project which is supposed to use a package from /packages directory. I keep getting error when I run composer update or composer install (I even tried clearing composer’s cache):
Your requirements could not be resolved to an installable set of
packages.Problem 1
– Root composer.json requires gata/gata-webhooks, it could not be found in any version, there may be a typo in the package name.Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting see
https://getcomposer.org/doc/04-schema.md#minimum-stability for more
details.- It’s a private package and you forgot to add a custom repository to find it
Following is the directory structure of my main project and the sub package. The main project is on the “main” git branch.
I added the following code in my main project’s composer file:
"require": {
"php": "^8.2",
"laravel/framework": "^11.9",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.9",
"gata/gata-webhooks": "*"
},
...
"autoload": {
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/",
"Gata\GataWebhooks\": "packages/gata-webhooks/src/"
}
}
...
"extra": {
"laravel": {
"dont-discover": [],
"providers": [
"Gata\GataWebhooks\GataWebhooksServiceProvider"
]
},
"repositories": [
{
"type": "path",
"url": "./packages/*",
"options": {
"symlink": true
}
}
]
},
...
},
"minimum-stability": "dev",
"prefer-stable": true
And my package has the following in it’s composer.json
{
"name": "gata/gata-webhooks",
"description": "Webhooks to receive payloads from e-commerce systems",
"version": "1.0.0",
"type": "library",
"license": "MIT",
"autoload": {
"psr-4": {
"Gata\GataWebhooks\": "src/"
}
},
"require": {
},
"minimum-stability": "dev",
"prefer-stable": true
}
Can someone please tell me what I am doing wrong?