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 table from an API Platform collection endpoint, using Twig Components and Stimulus.

API Grid now requires survos/grid-bundle and extends its GridController. Grid owns DataTables core (currently 3.1.3), the Bootstrap 5 / Tabler styling, extension pins, initialization and teardown. API Grid owns the API Platform requests, server-side pagination, facets, filters, selection actions and browser-side Twig rendering. Both render HTML tables; choose base Grid for in-memory rows or a single JSON fetch.

Key features:

Requirements

Install

Assets are registered via Symfony UX and AssetMapper. The canonical package names are @survos/api-grid-bundle and @survos/grid-bundle; remove obsolete application overrides using @survos/api-grid or @survos/grid. Do not run importmap:require @survos/api-grid.

Routing

path() in column blocks and the grid's own links come from the app's assets/router.js (symfony/ux-router), imported by the controller as router. Map it in importmap.php and expose the routes your blocks call:

@survos/grid-bundle/src/controllers/grid_controller.js is declared in this package's symfony.importmap, so Flex adds it. An app with synchronize_package_json: false must add it by hand.

Run php bin/console importmap:install after upgrading and clear the application cache. DataTables pins come from Grid's symfony.importmap manifest. Reconcile stale application pins with that manifest; changing npm dependencies alone does not update Flex importmaps.

Core CSS is imported by the controller. Extensions and their CSS load only when the selected grid features require them. Remove old global DataTables CSS autoimports from application controller configuration. Detail dialogs reuse window.bootstrap when supplied by the host or import Modal / Offcanvas from the host's @tabler/core; Tabler does not create that global itself.

The unqualified <twig:item_grid> component now belongs to Grid. Use <twig:api_item_grid> for API Grid's legacy recursive detail component. API Grid retains its richer Column metadata and API-specific components.

Verification status

The shared base is exercised by Showcase's /browse page over 23 Site entities. Search, sorting, pagination, page-size changes and navigation away/back passed locally on October 4, 2026. That page uses <twig:grid> and does not prove API-backed behavior. Tree-demo's /playground/topics provides Grid and Grid + Responsive comparisons; its existing /topic/index is the API Grid follow-up target.

The shared PHP suite passes 10 tests / 116 assertions, and the JavaScript suite passes six tests covering lazy assets, disconnect/reconnect and API controller inheritance. Live API pagination, facets and detail dialogs still need application smoke tests after publication. See Grid's docs/testing.md and docs/upgrading.md in the mono repository for the full checks and migration notes.

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.7
doctrine/persistence Version ^4.1
symfony/config Version ^7.4||^8.1
symfony/dependency-injection Version ^7.4||^8.1
symfony/http-kernel Version ^7.4||^8.1
symfony/options-resolver Version ^7.4||^8.1
symfony/ux-router Version ^3.6
symfony/ux-twig-component Version ^3
twig/twig Version ^3.4|^4.0
symfony/dom-crawler Version ^7.4||^8.1
api-platform/symfony Version ^5.0
survos/js-twig-bundle Version ^2.5
survos/kit-bundle Version ^2.5
survos/field-bundle Version ^2.5
survos/grid-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 ...