Download the PHP package dedomorozoff/laravel-xero-dedo without Composer

On this page you can find all versions of the php package dedomorozoff/laravel-xero-dedo. 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 laravel-xero-dedo

Latest Version on Packagist Total Downloads

Logo

Laravel package for working with the Xero API

Watch a video walkthrough https://www.youtube.com/watch?v=sORX2z-AH1k

Xero API documentation can be found at: https://developer.xero.com/documentation/

Before you can integrate with Xero you will need to create an app, go to https://developer.xero.com/myapps to register a new app.

For the grant type select, Auth code (web app)

For OAuth 2.0 redirect URI enter the full URL you want to use for connection to Xero from your application such as https://domain.com/xero/connect

Install

You can install the package via composer:

Config

You can publish the config file with:

Migration

You can publish the migration with:

After the migration has been published you can create the tokens tables by running the migration:

.ENV Configuration Ensure you've set the following in your .env file:

Middleware

To restrict access to routes only to authenticated users there is a middleware route called XeroAuthenticated

Add XeroAuthenticated to routes to ensure the user is authenticated:

To access token model reference this ORM model:

Multi-tenancy

To set the tenant call setTenantId and pass in your tenant_id

Once set all calls will use the set tenant.

Commands

Refresh Token

When using Xero as a background process, tokens will need to be renwed, to automate this process use the command:

This will refresh the token when its due to expire. Its recommended to add this to a schedule ie inside App\Console\Kernal.php add the command to a schedule.

Usage

A routes example:

Or using a middleware route, if the user does not have a token then automatically redirect to get authenticated:

Once authenticated you can call Xero:: with the following verbs:

The second param of array is not always required, its requirement is determined from the endpoint being called, see the API documentation for more details.

These expect the API endpoints to be passed, the URL https://api.xero.com/api.xro/2.0/ is provided, only endpoints after this should be used ie:

Is Connected

Anytime you need to check if Xero is authenticated you can call a ->isConnected method. The method returns a boolean.

To do an action when a Xero is not connected can be done like this:

Disconnect

To disconnect from Xero call a ->disconnect() method.

The disconnect will send a POST request to Xero to revoke the connection, in addition, the stored token will be deleted.

Typically you only want to run this is there is a connection, so it makes sense to wrap this in a ->isConnected() check:

Contacts

Xero provides a clean way of working with Xero contacts.

To work with contacts first call ->contacts() followed by a method.

List Contacts

To list contacts call the contacts()->get() method.

Xero docs for listing contacts - https://developer.xero.com/documentation/api/contacts#GET

The optional parameters are $page and $where. $page defaults to 1 which means being back on the first page, for additional pages enter higher page numbers until there are no pages left to return. The API does not offer a count to determine how many pages there are.

$where allows for filter options to be passed, the most common filters have been optimised to ensure performance across organisations of all sizes. We recommend you restrict your filtering to the following optimised parameters.

Filter by name:

Filter by email:

Filter by account number:

View Contact

To view a single contact a find method can be called passing in the contact id

Create Contacts

To create a contact call a store method passing in an array of contact data:

See https://developer.xero.com/documentation/api/contacts#POST for the array contents specifications

Update Contact

To update a contact 2 params are required the contact Id and an array of data to be updated:

See https://developer.xero.com/documentation/api/contacts#POST for details on the fields that can be updated.

Invoices

Xero provides a clean way of working with Xero invoices.

To work with invoices first call ->invocies() followed by a method.

List Invoices

To list invoices call the invoices()->get() method.

Xero docs for listing invoices - https://developer.xero.com/documentation/api/invoices#get

The optional parameters are $page and $where. $page defaults to 1 which means being back on the first page, for additional pages enter higher page numbers until there are no pages left to return. The API does not offer a count to determine how many pages there are.

$where allows for filter options to be passed, the most common filters have been optimised to ensure performance across organisations of all sizes. We recommend you restrict your filtering to the following optimised parameters.

Filter by status:

Filter by contact id:

Filter by contact number

Filter by reference

Filter by date

Filter by type

View Invoice

To view a single invoice a find method can be called passing in the invoice id

Online Invoice

For invoices created that have a status of either Submitted, Authorised, or Paid an online invoice can be seen by calling onlineUrl passing in the invoiceId

Create Invoice

To create a invoice call a store method passing in an array of invoice data:

See https://developer.xero.com/documentation/api/invoices#post for the array contents specifications

Update Invoice

To update an invoice 2 params are required the invoice Id and an array of data to be updated:

See https://developer.xero.com/documentation/api/invoices#post for details on the fields that can be updated.

PDF resources

Some Xero resources support being downloaded as PDF. To do this you can:

Change log

Please see the changelog for more information on what has changed recently.

Contributing

Contributions are welcome and will be fully credited.

Contributions are accepted via Pull Requests on Github.

Pull Requests

Security

If you discover any security related issues, please email [email protected] email instead of using the issue tracker.

License

license. Please see the license file for more information.


All versions of laravel-xero-dedo with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version 5.5.x|5.6.x|5.7.x|5.8.x|6.x|7.x|8.x|9.x|10.x
league/oauth2-client Version ^1.4|^2
guzzlehttp/guzzle Version 6.x|7.x
ext-json Version *
ext-fileinfo Version *
ext-curl Version *
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 dedomorozoff/laravel-xero-dedo contains the following files

Loading the files please wait ....