PHPackages                             m2mtech/api-platform-datatables-format - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. m2mtech/api-platform-datatables-format

AbandonedArchivedSymfony-bundle[API Development](/categories/api)

m2mtech/api-platform-datatables-format
======================================

Datatables format extension for API Platform.

v1.1.1(4y ago)284[1 PRs](https://github.com/m2mtech/api-platform-datatables-format/pulls)MITPHPPHP &gt;=7.2.5

Since Feb 11Pushed 2y ago2 watchersCompare

[ Source](https://github.com/m2mtech/api-platform-datatables-format)[ Packagist](https://packagist.org/packages/m2mtech/api-platform-datatables-format)[ Docs](https://github.com/m2mtech/api-platform-datatables-format)[ RSS](/packages/m2mtech-api-platform-datatables-format/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (10)Versions (6)Used By (0)

API Platform Datatables Format
==============================

[](#api-platform-datatables-format)

[![Author](https://camo.githubusercontent.com/f7f4b78e6905bcc447517f1d77b7160678f98c9ad66899a442b7114bb8e09d1f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406d326d746563682d626c75652e7376673f7374796c653d666c61742d737175617265)](http://www.m2m.at)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

---

This bundle provides the [Datatables format](https://datatables.net) to the [API Platform](https://api-platform.com).

Installation
------------

[](#installation)

```
composer require m2mtech/api-platform-datatables-format
```

If you are not using Flex enable the bundle:

```
// config/bundles.php

return [
    // ...
    M2MTech\ApiPlatformDatatablesFormat\M2MTechApiPlatformDatatablesFormatBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

Enable the datatables format:

```
# config/packages/api_platform.yaml
api_platform:
    formats:
        datatables: [ 'application/vnd.datatables+json' ]
```

### Pagination

[](#pagination)

The package rewrites the query parameters `start` and `length` from [datatables](https://datatables.net/manual/server-side) to `page` and `itemsPerPage` or whatever you have set as `page_parameter_name` and `items_per_page_parameter_name` for the [API Platform](https://api-platform.com/docs/core/pagination).

e.g.:

```
- /api/offers?draw=1&start=0&length=10
+ /api/offers?draw=1&page=1&itemsPerPage=10
```

Pagination is enabled by default in the [API Platform](https://api-platform.com/docs/core/pagination).

### Sorting

[](#sorting)

The package rewrites the query parameters `columns` and `order` from [datatables](https://datatables.net/manual/server-side) to `order` or whatever you have set as `order_parameter_name` for the [API Platform](https://api-platform.com/docs/core/pagination).

e.g.:

```
- /api/offers?draw=2&columns[0][data]=name&columns[1][data]=price&order[0][column]=1&order[0][dir]=desc
+ /api/offers?draw=2&order[email]=desc
```

You need to enable sorting for the [API Platform](https://api-platform.com/docs/core/pagination).

e.g. in your entity definition:

```
#[ApiFilter(OrderFilter::class, properties: ['name', 'price'])]
```

### Search

[](#search)

The package rewrites the query parameters `columns` and `search` from [datatables](https://datatables.net/manual/server-side) to `or` for the [Filter logic for API Platform](https://github.com/metaclass-nl/filter-bundle).

e.g.:

```
- /api/offers?draw=3&columns[0][data]=name&columns[1][data]=description&search[value]=shirt
+ /api/offers?draw=2&or[name]=shirt&or[desciption]=shirt
```

You need to install [Filter logic for API Platform](https://github.com/metaclass-nl/filter-bundle), an equivalent bundle or your own filter for this functionality, e.g.:

```
composer require metaclass-nl/filter-bundle "dev-master"
```

You need also to enable the search filter for the [API Platform](https://api-platform.com/docs/core/pagination).

e.g. in your entity definition:

```
#[ApiFilter(SearchFilter::class, properties: ['name' => 'partial', 'description' => 'partial'])]
#[ApiFilter(FilterLogic::class)]
```

### Output

[](#output)

Including the data, the output contains `recordsTotal` and `recordsFiltered` (which are always the same) as well as the `draw` parameter from the query.

Testing
-------

[](#testing)

This package has been developed for php 7.4 with compatibility tested for php 7.2 to 8.1.

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

1557d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0eabe14e40ffa0bddbc937846a7a4174672ba39026c6eee7d81906d3e39e5d4c?d=identicon)[m2mtech](/maintainers/m2mtech)

---

Top Contributors

[![m2mtech](https://avatars.githubusercontent.com/u/1568448?v=4)](https://github.com/m2mtech "m2mtech (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

apiformatdatatablesextensionapi-platform

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/m2mtech-api-platform-datatables-format/health.svg)

```
[![Health](https://phpackages.com/badges/m2mtech-api-platform-datatables-format/health.svg)](https://phpackages.com/packages/m2mtech-api-platform-datatables-format)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[indragunawan/api-rate-limit-bundle

Rate limits protection for api-platform resources.

68112.4k](/packages/indragunawan-api-rate-limit-bundle)[rekalogika/mapper

An object mapper for PHP and Symfony. Maps an object to another object. Primarily used for transforming an entity to a DTO and vice versa.

3847.7k1](/packages/rekalogika-mapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
