Download the PHP package survos/api-grid-bundle without Composer

On this page you can find all versions of the php package survos/api-grid-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package api-grid-bundle

Survos API Grid Bundle

A Symfony bundle that renders a server-driven DataTables 3.0 grid from an API Platform collection endpoint, using Twig Components and a Stimulus controller.

Beta notice — This bundle ships with DataTables 3.0 beta packages (datatables.net-bs5 3.0.0-beta.2 and related extensions). Beta users get active upstream support from the DataTables team, which means faster bug fixes and direct access to new features.

Key features:

Requirements

Install

Assets are registered via Symfony UX. Add the Stimulus controller to your importmap.php:

Quick Start

This four-step setup gives you a working sortable, searchable, filterable grid.

1. Annotate the entity

Add API Platform filters to the entity. The bundle reads these annotations to infer which columns are sortable, searchable, and filterable without any explicit column configuration.

If you use survos/field-bundle, annotate properties instead — see Field-Bundle Integration.

2. Compute the collection URL in the controller

Resolve the URL server-side so the template gets a plain string. This keeps the Twig template simple and makes debugging straightforward (the URL is visible in the browser network tab).

3. Render the grid in Twig

The col() Twig function is provided by the bundle. Each call returns a Column object. Arguments map directly to Column properties — see Column Reference.

4. Enable client-side pagination

DataTables uses limit/offset (not page). The bundle ships a SlicePaginationExtension that handles this, but API Platform must allow client control:


Entity Setup

Sorting

Global search

The Stimulus controller sends the search box value as individual field parameters (one per searchable column). For a single unified ?search= parameter, use MultiFieldSearchFilter:

Facet filters (ColumnControl / SearchBuilder)

Columns marked browsable: true use this filter. In ColumnControl mode they render as searchable dropdowns; in SearchBuilder mode they appear as criteria fields.


Field-Bundle Integration

If survos/field-bundle is installed, add #[Field] to entity properties instead of #[ApiFilter]. The bundle reads FieldDescriptor objects from FieldReader and uses them as the authoritative source for column settings.

#[Field] drives: searchable, sortable, browsable (via filterable + widget), visible, width, widget.

Explicit col() arguments always override #[Field] defaults. See Field-Bundle Integration for the full layering rules.


Twig Component Reference

Column Reference

Columns can also be passed as plain arrays (backward compatible):


Widget Modes

The grid supports two filter UI modes. See docs/widgets.md for full documentation.

ColumnControl (recommended)

Per-column dropdowns embedded directly in the column headers. Ideal when the page already has a sidebar (e.g. EasyAdmin, Tabler).

Browsable columns (browsable: true) render as searchable dropdown lists.
Columns with widget: 'range' render as min/max number inputs.

SearchBuilder

A modal query builder with AND/OR logic. Browsable columns appear as criteria fields.


Custom Cell Rendering

Pass :caller="_self" and add <twig:block name="fieldName"> blocks to override rendering for specific columns. The variable row contains the full deserialized API response row.

Blocks are compiled server-side by the js-twig-bundle Twig-to-JS bridge and executed in the browser by the Stimulus controller, so you can use Symfony Twig functions (path(), asset(), trans(), etc.) inside the blocks.


Row Actions

Add a non-searchable _actions column and render it with a <twig:block>:

row.rp contains the route parameters exposed in the serialized API response. Include the rp property in the entity's serialization group.

Stimulus helpers work too:

Offcanvas Detail Panel

Pass showRoute to add a "View" button per row. Clicking it fetches the route and renders the HTML in a Bootstrap Offcanvas panel — no page navigation.

The route receives row.rp as parameters. Add ?_page_content_only=1 handling in the controller/template to return only the content fragment.


Bulk Actions

Enable select=true and define bulkActions to let users select rows and POST their IDs to a server endpoint.

The controller receives ids[] (array of entity IDs) and className (FQCN) as a POST form submission. A CSRF token is included automatically.


Admin Browser

A generic admin browser route is registered at /admin/browse/{code}. The code is derived from the bundle/app prefix plus the entity short name:

/admin/browse lists all registered Doctrine entities.

If a route named {code}_show exists, the browser passes it as showRoute, enabling the offcanvas detail panel automatically.


Backend Filters

Repository facet counts

Facet counts (shown in ColumnControl dropdowns) require a repository method that can count distinct values per field. Install the trait from survos/core-bundle:

Pagination

The bundle's SlicePaginationExtension translates limit/offset from the DataTables request into Doctrine range queries. This runs automatically when the bundle is installed.


Further Reading


All versions of api-grid-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
doctrine/doctrine-bundle Version ^3.0
doctrine/orm Version ^3.3
doctrine/persistence Version ^4.1
symfony/config Version ^8.1
symfony/dependency-injection Version ^8.1
symfony/http-kernel Version ^8.1
symfony/options-resolver Version ^8.1
symfony/ux-twig-component Version ^3
twig/twig Version ^3.4|^4.0
symfony/dom-crawler Version ^8.1
api-platform/symfony Version ^4.1 || ^5.0
survos/js-twig-bundle Version ^2.5
survos/kit-bundle Version ^2.5
survos/field-bundle Version ^2.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package survos/api-grid-bundle contains the following files

Loading the files please wait ...