Download the PHP package kgdiem/xero-php without Composer

On this page you can find all versions of the php package kgdiem/xero-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package xero-php

XeroPHP

Build Status Latest Stable Version Total Downloads

A client library for the Xero API, including an OAuth interface and ORM-like abstraction.

This is loosely based on the functional flow of XeroAPI/XeroOAuth-PHP, but is split logically into more of an OO design.

This library has been tested with Private, Public and Partner applications.

Requirements

Setup

Using composer:

Otherwise just download the package and add it to your autoloader. Namespaces are PSR-4 compliant.

Usage

All the examples below refer to models in the XeroPHP\Models\Accounting namespace. Additionally, there are models for PayrollAU, PayrollUS, Files, and Assets

Create a XeroPHP instance (sample config included):

Load a collection of objects and loop through them

Load collection of objects, for a single page, and loop through them (Why?)

Search for objects meeting certain criteria

Load something by its GUID

Or create & populate it

Save it

If you have created a number of objects of the same type, you can save them all in a batch by passing an array to .

From v1.2.0+, Xero context can be injected directly when creating the objects themselves, which then exposes the method. This is necessary for the objects to maintain state with their relations.

Saving related models

If you are saving several models at once, by default additional model attributes are not updated. This means if you are saving an invoice with a new contact, the contacts ContactID is not updated. If you want the related models attributes to be updated you can pass a boolean flag with true to the save method.

Nested objects

Attachments

To set the IncludeOnline flag on the attachment, pass true as the second parameter for ->addAttachment().

PDF - Models that support PDF export will inherit a method, which returns the raw content of the PDF. Currently this is limited to Invoices and CreditNotes.

Refer to the a sample PHP app using this library.

Webhooks

If you are receiving webhooks from Xero there is Webhook class that can help with handling the request and parsing the associated event list.

See: Webhooks documentation

Validating Webhooks

To ensure the webhooks are coming from Xero you should validate the incoming request header that Xero provides.

See: Signature documentation

Handling Errors

Your request to Xero may cause an error which you will want to handle. You might run into errors such as:

These are just a couple of examples and you should read the official documentation to find out more about the possible errors.

Thrown exceptions

This library will parse the response Xero returns and throw an exception when it hits one of these errors. Below is a table showing the response code and corresponding exception that is thrown:

HTTP Code Exception
400 Bad Request \XeroPHP\Remote\Exception\BadRequestException
401 Unauthorized \XeroPHP\Remote\Exception\UnauthorizedException
403 Forbidden \XeroPHP\Remote\Exception\UnauthorizedException
404 Not Found \XeroPHP\Remote\Exception\NotFoundException
500 Internal Error \XeroPHP\Remote\Exception\InternalErrorException
501 Not Implemented \XeroPHP\Remote\Exception\NotImplementedException
503 Rate Limit Exceeded \XeroPHP\Remote\Exception\RateLimitExceededException
503 Not Available \XeroPHP\Remote\Exception\NotAvailableException
503 Organisation offline \XeroPHP\Remote\Exception\OrganisationOfflineException

See: Response codes and errors documentation

Handling exceptions

To catch and handle these exceptions you can wrap the request in a try / catch block and deal with each exception as needed.

See: Working with exceptions


All versions of xero-php with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kgdiem/xero-php contains the following files

Loading the files please wait ....