I have created a simple PHP-validation plugin.
I submit it in Packagist.Everything in Packagist seems fine but when I run my composer require command
composer require rahulreghunath11/php-rvalidation
Could not find package rahulreghunath11/php-rvalidation at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
showing this error.
my composer file is
{
"name": "rahulreghunath11/php-rvalidation",
"type": "library",
"description": "PHP form validation plugin ",
"keywords": ["validation","bootstrap validation"],
"homepage": "https://github.com/rahulreghunath11/php-form-validation",
"license": "MIT",
"authors": [
{
"name": "Rahul Reghunath",
"email": "reghunath11#gmail.com",
"role": "developer"
}
]
}
any idea?
That error means that the composer.json file for your project (NOT your validation plugin) is missing a minimum-stability indicator that allows development packages, so it's defaulting to stable.
Your validation plugin is only available as dev-master, because you haven't tagged any releases in Github yet. That means that in order for the require to work, you either have to explicitly tell it to fetch dev-master, or you need to set minimum-stability for your project to dev.
Edit:
To tell your project to use the dev-master package, specify it manually in your (project) composer.json file:
{
"name": "example/example-app",
"require": {
"rahulreghunath11/php-rvalidation": "dev-master"
}
}
Alternatively, if you want to be able to use composer require from the commandline and have it add the dev-master version automatically, set the minimum-stability to dev in your (project) composer.json file:
{
"name": "example/example-app",
"minimum-stability": "dev",
"require": {
}
}
Now composer will let you add packages that do not have releases:
composer require rahulreghunath11/php-rvalidation
Related
I am learning on how to upload a package on packagist.org. I created a github repository for testing with composer.json file -
https://github.com/perials/check
and a composer package using this github repository - https://packagist.org/packages/perials/check
When I try to install this package using composer require perials/check I get below error
[InvalidArgumentException]
Could not find a version of package perials/check matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability.
From what I read in other related questions on SO this error occurs if there are no stable releases of github branch. But thing is that I already have some releases.
I also tried composer require perials/check:dev-master and composer require perials/check:7.1.0 but then I get below error
[InvalidArgumentException]
Could not find package perials/check.
Did you mean this?
perials/check
It was an issue with Singapore mirror for the packagist metadata. Now it should be resolved. https://github.com/composer/composer/issues/8347#issuecomment-537176755
If still not solve your issue please add "minimum-stability": "dev" in your composer.json
{
"name": "perials/check",
"description": "Package for testing packagist",
"license": "MIT",
"authors": [
{
"name": "Perials",
"email": "info#perials.com"
}
],
"autoload": {
"psr-4": {"Abc\\": "src/xyz"}
},
"require": {},
"minimum-stability": "dev"
}
I am also learning how to create packages and have the same problem, but in my case I created a v1.0.0 tag for my package and that solves the problem.
You can accept no stable version packages. See composer in docs (https://getcomposer.org/doc/04-schema.md#package-links).
Paste piece here for convinience:
You can apply them to a constraint, or apply them to an empty constraint if you want to allow unstable packages of a dependency for example.
composer.json:
{
"require": {
"monolog/monolog": "1.0.*#beta",
"acme/foo": "#dev"
}
}
In your case you would do:
{
"require": {
"perials/check": "7.1.0#dev"
}
}
and then run rm composer.lock; composer install.
I have been trying to create a simple composer package. But I'm stuck with the following issue. Dont know how to resolve this.
[InvalidArgumentException]
Could not find package sarav/sample-package at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
Package Url : https://packagist.org/packages/sarav/sample-package
I ran the following composer command
composer require sarav/sample-package
My composer contents
{
"name": "sarav/sample-package",
"description": "Sample package",
"type": "Library",
"license": "MIT",
"authors": [
{
"name": "Sarav",
"email": "me#sarav.co"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-0": {
"Sarav": "src/"
}
}
}
Your package config looks good to me, but your Git repo doesn't have any tagged versions.
Use git tag v1.0.0 or whatever version is appropriate, then git push origin --tags to update on GitHub.
Alternatively, you can go without tagged versions by specifying the master branch when you require the package, like so:
composer require sarav/sample-package dev-master
You can require any branch in this manner, but the dev- prefix is mandatory.
As the title goes, I am trying to install Merchant SDK for Express Checkout API on Paypal.
composer.json
{
"name": "paypal/merchant-sdk-php",
"description": "PayPal Merchant SDK for PHP",
"keywords": ["paypal", "php", "sdk"],
"homepage": "https://developer.paypal.com",
"license": "proprietary",
"authors": [
{
"name": "PayPal",
"homepage": "https://github.com/paypal/merchant-sdk-php/contributors"
}
],
"require": {
"php": ">=5.3",
"ext-curl": "*",
"paypal/merchant-sdk-php":"v3.6.106"
},
"autoload": {
"psr-0": {
"PayPal\\Service": "lib/",
"PayPal\\CoreComponentTypes": "lib/",
"PayPal\\EBLBaseComponents": "lib/",
"PayPal\\EnhancedDataTypes": "lib/",
"PayPal\\PayPalAPI": "lib/"
}
}
}
And when I run composer update, here is the error I get:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package paypal/merchant-sdk-php 1.0.0 could not be found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min
imum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> f
or more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common
problems.
I tried installing another package, the button manager SDK. And that required me to change the last line in "require" to "paypal/buttonmanager-sdk-php":"v3.6.106"
And that worked.
I have no idea why does it search for version 1.0.0 in case of merchant SDK and reports an error that it can't find it.
I am taking my instructions from the official page here
Please provide an insight into my problem, and do ask for any additional information if required.
In your composer.json keep only the required stuffs. If you only creating a component / package which need to be installed via composer, you need to define the name, description, keywords etc.
So for your project to need any package just keep the package name and version name. So your composer.json will look like
{
"require": {
"paypal/merchant-sdk-php": "3.6.106"
}
}
Alternatively you can do via composer require paypal/merchant-sdk-php and giving the version name.
I have written a library that I want to use in another project. However, when I add the library dependency to my project I get the following error after running composer update -vvv:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for my/library dev-master -> satisfiable by my/library[dev-master].
- my/library dev-master requires doctrine/migrations dev-master -> no matching package found.
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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
This error is very confusing to me since my project has my library as it's only dependency, i.e. my project composer.json looks like this:
{
"name": "my/project",
"type": "project",
"description": "My project",
"autoload": {
"psr-0": { "MyNamespace\\": ["src/", "tests/src/"] }
},
"repositories": [ {
"type": "vcs",
"url": "git#bitbucket.org:my/library"
} ],
"require": {
"php": ">=5.5",
"my/library": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "3.*"
}
}
As you can see, pretty straight forward. The reason the version of my library is requiring dev-master is because master is currently the only branch I work on (I work alone, no need for other branches at the moment).
So far the only way for the resolve this problem is by adding the dependencies of my library composer.json to my project's composer.json which seems like an unnecessary step.
How can I resolve this dependency issue?
It looks to me as if it is a stability issue. Add the following two lines to your composer.json:-
"minimum-stability": "dev",
"prefer-stable": true,
ref:- minimum-stability & prefer-stable
Hopefully that will sort out your problem.
I have the following json configs for composer.phar. Unfortunately, I get this error, and I don't understand why:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for myproject/cmsapp dev-master -> satisfiable by myproject/cmsapp[dev-master].
- myproject/cmsapp dev-master requires zendframework/zendframework dev-master -> no matching package found.
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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
cms config:
{
"name": "myproject\/cms",
"description": "myproject CMS Tool",
"license": "GPL",
"keywords": [
"myproject",
"cms",
"framework",
"zf2"
],
"homepage": "http:\/\/avadon.com\/myproject\/cms\/",
"require": {
"php": ">=5.3.3",
"myproject/cmsapp": "dev-master"
},
"repositories": {
"myproject/cmsapp": {
"type": "git",
"url": "https:\/\/github.com\/myproject\/cmsapp.git"
}
}
}
cmsapp config:
{
"name": "myproject/cmsapp",
"repositories": {
"zendframework/zendframework": {
"type": "git",
"url": "https://github.com/zendframework/zf2.git"
}
},
"require": {
"php": ">=5.3.3",
"zendframework/zendframework" : "dev-master"
}
}
Can anyone try and explain to me this error?
You are using a software from a development branch. This will only be allowed if you configure your composer.json to accept development software. Usually you shouldn't do this.
Especially including the development branch from Zend framework is likely to break your software more than once if large enough updates occur. If you want the latest and greatest, you'd still have to call composer update all the time to fetch the newest commits, so it's less error-prone to simply require something like "2." for "any version 2 framework", or maybe even stricter "2.3." for a released, working version of the 2.3 version line.
The same would be true for your own software - do tag it!
But if you want to experience unintentional software incompatibilities yourself, you can add a "minimum-stability":"dev" to your cms config's composer.json and include all development versions of the world.