Composer: google-api-php-client does not exist in any version - php

I am trying to install the google-api-php-client on a Windows system (for local testing) using Composer.
But when I run composer require google-api-php-client:2.0#RC in my project directory, Composer states that
The requested package google-api-php-client could not be found in any version, there may be a typo in the package name.
The command I ran is directly from Google's documentation. I've searched both StackOverflow and the rest of the Internet for someone with the same problem but haven't found anyone. However, I was able to install a previous version of another similar Google package (which doesn't meet my needs) so I know that Composer is connecting to the database.

The package is called: google/apiclient
You can check it on the github repository.

Related

What does the composer "provide" do?

I'm using Laravel + VueJS to recreate a POS system from work. I needed to install sped-nfe package to work with it on a system for work.
This package requires many other packages in order to function properly, like ext-curl, ext-soap, ext-json.
As per instructions, I added
"nfephp-org/sped-nfe" : "^5.0"
to my composer.json.
When I ran composer install or composer update, the following error ocurred:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- nfephp-org/sped-nfe[v5.0.100, ..., v5.0.122] require ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
- Root composer.json requires nfephp-org/sped-nfe ^5.0 -> satisfiable by nfephp-org/sped-nfe[v5.0.100, ..., v5.0.122].
To enable extensions, verify that they are enabled in your .ini files:
- C:\laragon\bin\php\php-7.4.19-Win32-vc15-x64\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
I'm using Windows and I'm not authorized to modify our local server nor the actual server, I was getting frustrated trying to find a solution to my problem - almost every answer would tell me to modify my php.ini or install curl with sudo apt-get - I arbitrarily decided to add the following lines to my composer.json:
"provide": {
"ext-curl":"*",
"ext-soap":"*"
},
Et voilĂ , composer update and composer install were working smoothly.
What's bothering me is, according to the composer documentation,
provide
Map of packages that are provided by this package. This is mostly
useful for implementations of common interfaces. A package could
depend on some virtual package e.g. psr/logger-implementation, any
library that implements this logger interface would list it in
provide. Implementors can then be found on Packagist.org.
Using provide with the name of an actual package rather than a virtual
one implies that the code of that package is also shipped, in which
case replace is generally a better choice. A common convention for
packages providing an interface and relying on other packages to
provide an implementation (for instance the PSR interfaces) is to use
a -implementation suffix for the name of the virtual package
corresponding to the interface package.
I am not providing this package, I simply wanted to require it but ended up putting it differently. Also, I've tried requiring it, but the error was still there.
Was this a good solution to my problem or should I do it differently?
Is there anything about this that I should worry?
Can someone explain the 'provide' syntax for me?
If you add a package or a PHP extension to the provide section, you tell composer that your package itself or the external system setup "provides" this one. The dependency resolver is fine with this.
This does not check further whether this dependency is actually properly resolved or not. Composer relies on your statement that this is not a lie ;) So, if you only add this to the section without properly providing that package, you cannot be sure that your application works properly.
In your example: the package you want to install requires the SOAP extension. It won't work properly without it. If you cannot install that extension on your server, you should not use this package.

Error report for global use of composer under Windows system

I have tried to install composer according to the three methods provided by composer's official website. There is no problem in executing composer - V under PHP installation directory. However, if you execute composer - V in any directory in any way, the following error will be reported repeatedly:
This is the error output from the implementation of composer - V and the PHP version number
I don't know if the latest version of composer is not uninstalled and there are residual error. This question has made my head swell. Which international friend can take a look at it!
The problem has been solved. I used the software installation method from the official Composer website. When setting the environment variables, I put the composer path first, and then I can use composer in any directory, although I don't know what happened in the end. This is a screenshot of the environment variables configured in my Windows 10.

PHP Paypal Rest API Composer Installation

I'm trying to install the Paypal PHP REST API, by following the instructions on this page.
https://github.com/paypal/PayPal-PHP-SDK/wiki/Installation-Composer
Namely, I'm running this command on composer.
composer require "paypal/rest-api-sdk-php:*"
However, I'm running into this error.
Problem 1
- The requested package paypal/rest-api-sdk-php 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.
The instructions aren't working. Does this mean the API has been abandoned?
composer require "paypal/rest-api-sdk-php:
composer require paypal/rest-api-sdk-php
Remove the quote first or install another laravel application and try that again
Please try to use composer require paypal/rest-api-sdk-php:*
UPDATE:
Refer this link for more details : https://github.com/paypal/PayPal-PHP-SDK/wiki/Installation-Composer

Composer BowerPHP Error

I am trying to install BowerPHP in my Laravel framework project on my computer using Composer. I have used the composer require "beelab/bowerphp 0.3.*#beta" command in the command prompt but I'm receiving errors:
Can only install one of : symfony/process[v2.7.9,v3.0.2]
Can only install one of : symfony/process[v2.7.8,v3.0.2]
Can only install one of : symfony/process[v2.7.7,v3.0.2]
etc.
From what I understand my framework already has a version of Symfony and I cannot download another package. In addition, the package that I have is not compatible with BowerPHP. What do I do? And am I correct?
So I found the answer. The beelab team did not update their own website but did update their github page. running the composer require beelab/bowerphp:1.0.*#dev would work but running the on on their website would not.

Is it possible to install Doctrine without PEAR or Composer? If so, how?

My hosting provider doesn't allow using Composer or PEAR. Doctrine manual doesn't mention any other way of installing it.
How do I install Doctrine without using PEAR or Composer?
You can visit this page https://github.com/doctrine/doctrine2 and then Download ZIP at the right side of the page. Additional Doctrine related stuff can be found here https://github.com/doctrine and here https://github.com/l3pp4rd/DoctrineExtensions
EDIT: you can also install your vendors with composer locally and upload your vendor folder with your app when you have a production ready version.
You can use PEAR to install the packages locally and then ftp/scp it up to your host: http://pear.php.net/manual/en/installation.shared.php
This way you can use PEAR locally and don't need it on your server.

Categories