thephpleague/fractal — pull request #16 by ipalaus (2014-01-23 23:59:12+00:00)
Title: [Feature] Use cursors to navigate collections.

Using pagination is not the only way to navigate collections and when you're dealing with big sets of data you've to find creative ways. One of this ways is using cursors and I'm sure it will be useful to others.

```php
use League\Fractal\Cursor\Cursor;
use League\Fractal\Resource\Collection;

$users = new User;

if ($current = Input::get('cursor', false)) {
$users = $users->where('id', '>', $current);
}

$users = $users->take(5)->get();

$cursor = new Cursor($current, $users->last()->id, $users->count());

$resource = new Collection($users, new UserTransformer);
$resource->setCursor($cursor);
```

When outputting the above example, we will get the next:
```json