Skip to content

Instantly share code, notes, and snippets.

@jaredk2g
Last active September 12, 2016 21:29
Show Gist options
  • Save jaredk2g/1e36398a9c162e9ada66b337dd308921 to your computer and use it in GitHub Desktop.
Save jaredk2g/1e36398a9c162e9ada66b337dd308921 to your computer and use it in GitHub Desktop.
List the events for an invoice on Invoiced (PHP)
<?php
// prerequisite: run "composer require invoiced/invoiced"
require 'vendor/autoload.php';
$invoiced = new Invoiced\Client('TODO_INSERT_API_KEY');
$objectType = 'invoice';
$invoiceId = 'TODO_INSERT_INVOICE_ID';
// List the events for an object (i.e. an invoice)
$relatedTo = $objectType.','.$invoiceId;
list($events, $metadata) = $invoiced->Event->all(['related_to' => $relatedTo]);
foreach ($events as $event) {
echo $event;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment