Skip to content

Latest commit

 

History

History
32 lines (27 loc) · 969 Bytes

6.0-Upgrade.md

File metadata and controls

32 lines (27 loc) · 969 Bytes

Upgrading to chartmogul-php 6.0.0

This new version replaces the existing pagination for the .all() endpoints that used a combination of page and per_page parameters, and instead uses a cursor based pagination. So to list (as an example) Plans you now can:

// Getting the first page
$plans = ChartMogul\Plan::all([
    "per_page" => 1
]);

// This will return an array of plans (if available), and a cursor + has_more fields
{
    "plans": [
        {
            "uuid": "some_uuid",
            "data_source_uuid": "some_uuid",
            "name": "Master Plan"
        }
    ],
    "has_more": true,
    "cursor": "MjAyMy0wNy0yOFQwODowOToyMi4xNTQyMDMwMDBaJjk0NDQ0Mg=="
}

if ($plans->has_more) {
    $more_plans = ChartMogul\Plan::all([
        "per_page" => 1,
        "cursor" => $plans->cursor
    ])
}

If you have existing code that relies on the page parameter, those requests will throw an error now alerting you of their deprecation.