1. Go to this page and download the library: Download ayles-software/xero-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ayles-software / xero-laravel example snippets
namespace App\Http\Controllers;
use AylesSoftware\XeroLaravel\XeroOAuth;
class XeroOAuthController extends Controller
{
public function __invoke(XeroOAuth $xeroOAuth)
{
return $xeroOAuth->flow();
}
}
use AylesSoftware\XeroLaravel\Facades\Xero;
# Retrieve all contacts
$contacts = Xero::contacts()->get();
# Retrieve an individual contact by its GUID
$contact = Xero::contacts()->find('34xxxx6e-7xx5-2xx4-bxx5-6123xxxxea49');
# Retrieve contacts filtered by name
$contacts = Xero::contacts()->where('Name', 'ANZ')->get();
# Retrieve an individual contact filtered by name
$contact = Xero::contacts()->where('Name', 'ANZ')->first();
# Retrieve an individual contact by its GUID
$contact = Xero::contacts()->find('34xxxx6e-7xx5-2xx4-bxx5-6123xxxxea49');
# Retrieve multiple contact by their GUIDS
$contacts = Xero::contacts()->find([
'34xxxx6e-7xx5-2xx4-bxx5-6123xxxxea49',
'364xxxx7f-2xx3-7xx3-gxx7-6726xxxxhe76',
]);