I have developed one extension and I have uploaded that in my GitHub private repository
now I have tried to install it using
composer require --dev bhaveshpp/Percentoffsale
but I got error
In InitCommand.php line 727: Could not find a matching version of package bhaveshpp/Percentoffsale. Check the package spelling, your version constraint and that the package is available in a stability w hich matches your minimum-stability (stable).
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-de pendencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] []...
this is my composer.json file code
{
 "name": "bhaveshpp/Percentoffsale",
 "description": "A Magento 2 module that creates discount",
 "type": "magento2-module",
 "version": "0.1.0",
 "license": [
 "OSL-3.0",
 "AFL-3.0"
 ],
 "require": {
 "php": ">=7.0.0",
 "magento/framework": "~100.0.4"
 },
 "autoload": {
 "files": [ "registration.php" ],
 "psr-4": {
 "Zarathemes\\Percentoffsale\\": ""
 }
 }
 }
I have also try this solution
How to install an extension on a private Github using Composer?
{
 "name": "bhaveshpp/Percentoffsale",
 "description": "A Magento 2 module that creates discount",
 "type": "magento2-module",
 "version": "0.1.0",
 "license": [
 "OSL-3.0",
 "AFL-3.0"
 ],
 "require": {
 "php": ">=7.0.0",
 "magento/framework": "~100.0.4",
 "bhaveshpp/Percentoffsale": "dev-master"
 },
 "autoload": {
 "files": [ "registration.php" ],
 "psr-4": {
 "Zarathemes\\Percentoffsale\\": ""
 }
 },
 "repositories": [
 {
 "type": "vcs",
 "url": "[email protected]:bhaveshpp/Percentoffsale.git"
 }
 ]
 }
But i have got the same error.
If any one have a solution then provide
Any help would be appreciated.
Thanks in advance..!
2 Answers 2
Please set your repository Private to Public because the Private repository is not working for this operation.
Please set your package name in a lower case "bhaveshpp/Percentoffsale" to "bhaveshpp/percentoffsale".
Also, Check your GitHub repository into the "https://packagist.org/"
This solution will solve your issues.
Try with following composer.json file
{
 "name": "bhaveshpp/percentoffsale",
 "description": "A Magento 2 module that creates discount",
 "type": "magento2-module",
 "version": "0.1.0",
 "minimum-stability": "dev",
 "prefer-stable": "true",
 "license": "OSL-3.0", 
 "require": {
 "php": ">=5.4.0",
 "bhaveshpp/percentoffsale":"dev-master@dev"
 },
 "autoload": {
 "files": 
 [ 
 "registration.php" 
 ],
 "psr-4": {
 "Zarathemes\\Percentoffsale\\": ""
 }
 }
 }
In Github Repository, Release and Add a Tag.
- 
 it is usefull but my repository is private so it is not work for me thank youBhavesh Prajapati– Bhavesh Prajapati2019年11月14日 03:35:56 +00:00Commented Nov 14, 2019 at 3:35
- 
 First I have approved this extension by setting public repository and then it will installBhavesh Prajapati– Bhavesh Prajapati2019年11月14日 10:31:22 +00:00Commented Nov 14, 2019 at 10:31
Try to use this
"repositories": {
 "bhaveshpp-percentoffsale": {
 "type": "git",
 "url": "your_ssh_path_to_repo"
 }
}
Then execute "composer require bhaveshpp/percentoffsale"
- 
 thanku but it is not valid json format so it not workBhavesh Prajapati– Bhavesh Prajapati2019年11月12日 11:17:14 +00:00Commented Nov 12, 2019 at 11:17
- 
 updated my comment, try to convert package name to lower case and use only figure bracketsLeviathan– Leviathan2019年11月12日 11:23:05 +00:00Commented Nov 12, 2019 at 11:23