Drupal is a registered trademark of Dries Buytaert
Drupal 10.6.14 Update released for Drupal core (10.6.14)! Drupal 11.3.16 Update released for Drupal core (11.3.16)! Entity Usage 8.x-2.2 Minor update available for module entity_usage (8.x-2.2). Seven 2.0.0-beta8 New beta version released for theme seven (2.0.0-beta8). Seven 1.1.0-beta4 New beta version released for theme seven (1.1.0-beta4). Entity Usage 5.0.0-beta5 New beta version released for module entity_usage (5.0.0-beta5). Entity Usage 5.0.0-beta4 New beta version released for module entity_usage (5.0.0-beta4). Custom Field 5.0.0 Major update available for module custom_field (5.0.0). Layout Builder Restrictions 3.0.5 Module layout_builder_restrictions updated after 12 months of inactivity (3.0.5)... Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

The Page Serializer extends the default Serializer to include pagination data. This module is intended to be used with rest and the Rest export View with a decoupled UI. Including the pagination, data lets the front end know the total record count and other useful information. This eliminates the need to make another rest endpoint to get the total number of records.

Support the Drupal Association

You can support the continued success of the Drupal project by choosing to become a member or donate.

Configuration

  1. Navigate to Administration > Structure > Views > Add view and create a
    new view of REST EXPORT
  2. In the Format, select the 'Pager Serializer'.
  3. On the style settings, provide the Accepted request formats to use.
  4. In the Pager, select the 'Paged output, full pager'
  5. Save the settings and view the result.

Sample output

Pager Serializer produces output like the following.

{
  rows: [
    {...},
    {...}
  ],
  pager: {
    current_page: 0,
    total_items: 6,
    total_pages: 2,
    items_per_page: 5,
  }
}

Using Serializer with Views, only the rows are returned. This module extends Serializer to return the pagination data. All the property names are customizable, and properties can be disabled to meet the needs of the front end.

Views Serialization Pager is another contributed module which also exposes pagination data.

Develop Pager Serializer using DDEV ⚙

If you haven't already, install DDEV.

git clone [email protected]:project/pager_serializer.git
cd pager_serializer
ddev config --project-type=drupal --docroot=web --php-version=8.4 --corepack-enable --project-name=pager-serializer
ddev add-on get ddev/ddev-drupal-contrib
ddev add-on get s-ayers/ddev-drupal-contrib-mkdocs
ddev start
ddev poser
ddev symlink-project
ddev drush site:install -y
ddev drush pm:install pager_serializer -y
ddev drush config:export -y
ddev drush user:login

Activity

Total releases
1
First release
Jul 2026
Latest release
2 hours ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
2.0.x-dev Dev Jul 23, 2026