composer issue with Merchant SDK for Express Checkout API on Paypal - php

I want to integrate a method from which a guest also can do payments on my site. So, i am implementing this SDK of paypal. It is required to install the compser and run it for dependencies. So, i ran this command to install composer.phar file inside samples folder
curl -sS https://getcomposer.org/installer | php -- --install-dir=/var/www/html/app/paypaltest/samples
then to install composer i ran this command:
php composer.phar install
But it is showing error as
Loading composer repositories with package information
Installing 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 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.
Not sure why i am getting error of version 1.0.0 when i explicitly defining the version number i.e v3.8.107
This is the composer.json file which i am using. Can anyone help me know what is the issue and why can't i install the composer correctly. Am i missing any thing?
{
"name": "paypal/merchant-sdk-php",
"description": "PayPal Merchant SDK for PHP",
"keywords": ["paypal", "php", "sdk"],
"homepage": "https://developer.paypal.com",
"license": "Apache2",
"authors": [
{
"name": "PayPal",
"homepage": "https://github.com/paypal/merchant-sdk-php/contributors"
}
],
"require": {
"paypal/merchant-sdk-php":"v3.8.107"
},
"autoload": {
"psr-0": {
"PayPal\\Service": "lib/",
"PayPal\\CoreComponentTypes": "lib/",
"PayPal\\EBLBaseComponents": "lib/",
"PayPal\\EnhancedDataTypes": "lib/",
"PayPal\\PayPalAPI": "lib/"
}
}
}

Try just the following in your composer.json:
{
"require": {
"paypal/merchant-sdk-php": "v3.8.107"
}
}

Related

Getting "Could not find a version of package .." in composer inspite of having tags in Github branch of package

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.

installing Merchant SDK for Express Checkout API on Paypal

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.

Composer dependency error acquiring microsoft/windowsazure package

I'm having difficulty getting the PHP client libraries package for Windows Azure via Composer. The problem would appear to be around Pear dependencies the package has.
The contents of the composer.json file:
{
"require": {
"microsoft/windowsazure": "dev-dev"
},
"repositories": [
{
"type": "pear",
"url": "http://pear.php.net"
}
]
}
The output following running "composer update" reads:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for microsoft/windowsazure dev-dev -> satisfiable by microsoft/windowsazure[dev-dev].
- microsoft/windowsazure dev-dev requires pear-pear/http_request2 * -> no matching package found.
I've never experienced any difficulty getting this package in the past. I can provide more verbose logs on request.
I recall seeing a few issues raised due to changes in how replaces works in regards to pear bridging.
This issue needs to be fixed upstream to have pear-pear/* replaced with pear-pear.php.net/*, but as a workaround in your root composer.json you can explicitly require the dependencies in order to have them discovered by the solver.
{
"require": {
"microsoft/windowsazure": "dev-dev",
"pear-pear.php.net/http_request2": "*",
"pear-pear.php.net/mail_mime": "*",
"pear-pear.php.net/mail_mimedecode": "*"
},
"repositories": [
{
"type": "pear",
"url": "http://pear.php.net"
}
]
}
The above composer.json should work in the latest and future versions of composer. Tested with Composer version aa9c257f0efd1a54c93ba95282821a497bc15d75 2014-03-09 15:09:15
This is a composer bug, I fixed it by using an older version of composer. Your composer.json is fine. The version I used was:
Composer version 42c496752ab6ec6c45b185b70c8c39220da01b1c
https://github.com/composer/composer/archive/42c496752ab6ec6c45b185b70c8c39220da01b1c.zip

composer dependency json config

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.

Composer phar package not found

I am trying to create a new composer library package.
I created the composer.json file using the
composer.phar create-project xlix vendor/xlix/xlix 0.3
command.
In the filesystem the file composer.json exists under vendor/xlix/xlix and for testing purposes I copied it to vendor/xlix.
The composer.json file content is the following:
{
"name": "xlix/xlix",
"type": "library",
"description": "XLIX package",
"keywords": ["core"],
"homepage": "http://myhomepage",
"license": "GPL",
"authors": [
{
"name": "Florian Kasper",
"email": "florian.kasper#mymail"
}
],
"require": {
"php": ">=5.2.4"
},
"autoload": {
"psr-0" : {
"Xlix\\Bundle" : "lib/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0"
}
}
}
Then I tried the following commands:
git:(master) ✗ php composer.phar require xlix/xlix
git:(master) ✗ php composer.phat require vendor/xlix
...
git:(master) ✗ php composer.phar install vendor/xlix
git:(master) ✗ php composer.phar install xlix/xlix
...
Every time the same output:
Please provide a version constraint for the xlix/xlix requirement: *
composer.json has been updated
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package xlix/xlix 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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
In my ROOTDIR/composer.json file the package is registered in the require section.
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"kriswallsmith/assetic": "1.1.*#dev",
"xlix/xlix": ">=0.*"
Now I am on the edge of despair an don't know what to do anymore.
Question:
Are there any mistakes I've made or is there anything i missed?
Packages live on the internet, not on your filesystem.
Composer searches by default for a package called xlix/xlix on packagist and that does not exists. You can add more package repositories by using the repositories configuration, more about that in the documentation.
So, in order to require your package with composer you need to upload your xlix directory somewhere.
I don't see what you are trying to do in the lxix directory? You are in the lxix package, why do you want to require it in the same package? It looks like you don't understand what those commands do and how composer works. Maybe a good read in their own documentation -- or some other tutorials about Composer (like the one on nettuts+) -- will help you to get a better understanding of composer.

Categories