Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Getting Started >

Can't install Xero oAuth2

Started by Andy Clayton -   in Getting Started

I don't use Composer extensively so this may be user error! I'm trying to install Xero's oAuth2 package and added the following to composer.json as directed in the instructions:

"require": {
"xeroapi/xero-php-oauth2": "0.2.0"

However, when I run composer install I see the following:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package xeroapi/xero-php-oauth2 No version set (parsed as 1.0.0) is satisfiable by xeroapi/xero-php-oauth2 No version set (parsed as 1.0.0) but these conflict with your requirements or minimum-stability.

Running composer show -a xeroapi/xero-php-oauth2 shows that the latest version is 0.2.4 so I updated my composer.json file to that. The error was the same. I added the Xero require line at the very top of the require section in composer.json, I also tried placing at the end of the require section and setting a separate require section. None of these changes made any difference

Running composer install without the Xero requirement works and I get a full set of files. I can run the examples given right up until the callback when I see the following error:

Fatal error: Uncaught Error: Class 'XeroAPI XeroPHP Configuration' not found in callback.php:36 Stack trace: #0 {main} thrown in callback.php on line 36

Perhaps not surprising as the XeroAPI files aren't there, presumably.

I downloaded the files from GitHub but don't know where to put them or what to change in the files generated by composer, if indeed that's possible.

The GitHub page indicates that you can install manually by requiring "autoload.php" however there's no autoload.php anywhere in the download.

It's probably me, however I followed all of the instructions given to the letter and can't see where I may be doing something incorrectly.

Any help very much appreciated!
Best Reply as chosen by Andy Clayton (Original Poster)
As I suspected, this was totally my fault!

I'd built using composer in one place on my machine and then copied the vendor folder to my development server. I hadn't copied the "lib" folder as well. I've now moved everything into my dev location so composer can do what it needs to do and all necessary files are where they should be.

One other thing I did (and this was the main fault with the instructions I think) was to add version: "0.2.5" to the root tree of the composer.json file

Andy Clayton