Created
June 21, 2019 15:46
-
-
Save jaredk2g/82a12ffb2dcc3731c62fd8d1e6e0973b to your computer and use it in GitHub Desktop.
Retrieves customer list through Invoiced using pagination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require("../vendor/autoload.php"); | |
$invoiced = new Invoiced\Client("MY-API-KEY"); | |
$page = 1; | |
$hasNextPage = true; | |
while ($hasNextPage) { | |
list($customers, $metadata) = $invoiced->Customer->all(['page' => $page]); | |
foreach ($customers as $customer) { | |
echo "$customer->name\n"; | |
} | |
$hasNextPage = isset($metadata->links['next']); | |
$page++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment