Download the PHP package spyrit/doctrine-datagrid-bundle without Composer

On this page you can find all versions of the php package spyrit/doctrine-datagrid-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 doctrine-datagrid-bundle

DoctrineDatagridBundle

This bundle helps you to create and manage simple to complex datagrids quickly and easily.

Unlike other similar bundle already available on Github and/or Packagist, there is no magic method that will render the datagrid in you view. This technical choice allow you to completely customize your datagrid aspect and render (filter fields, buttons, columns, data displayed in each column, pagination links and informations, etc.).

This make it easy to implement and use in both back-end and front-end applications.

Still skeptical? Let's see how it works!

Installation

Get the code

To install this bundle automatically, use Composer:

composer req spyrit/doctrine-datagrid-bundle

Use it

Create your datagrids:

<?php

namespace App\Datagrid;

use App\Entity\Video;
use Spyrit\Bundle\DoctrineDatagridBundle\Datagrid\DoctrineDatagrid;
use Spyrit\Bundle\DoctrineDatagridBundle\Datagrid\DoctrineDatagridFactory;
use Symfony\Component\Form\Extension\Core\Type\TextType;

class VideoDatagrid
{
    private DoctrineDatagrid $datagrid;

    public function __construct(DoctrineDatagridFactory $factory)
    {
        $this->datagrid = $factory
            ->create('video', ['multi_sort' => false])
            ->select(['video'])
            ->id('video.id')
            ->query(function ($qb) {
                return $qb->from(Video::class, 'video');
            })
            ->filter('title', TextType::class, [
                'attr' => [
                    'placeholder' => 'Title',
                ],
                'translation_domain' => false,
                'required' => false,
            ], function ($value, $qb) {
                return $qb->andWhere('video.title LIKE :title')
                    ->setParameter('title', '%'.$value.'%');
            })
            ->setDefaultSort(['video.id' => 'desc'])
            ->setDefaultMaxPerPage(30);
    }

    public function execute(): DoctrineDatagrid
    {
        return $this->datagrid->execute();
    }
}

Use your datagrids in your controllers:

<?php

namespace App\Controller\Admin;

use App\Datagrid\VideoDatagrid;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

/**
* @Route("/video")
*/
class VideoController extends Controller
{
    /**
     * @Route("/list", name="video_index", methods={"GET","POST"})
     */
    public function index(VideoDatagrid $datagrid): Response
    {
        return $this->render('video/index.html.twig', [
            'datagrid' => $datagrid->execute(),
        ]);
    }
}

Render them in your views:

{% extends 'layout.html.twig' %}
{% import '@DoctrineDatagrid/Datagrid/macros.html.twig' as macros %}

{% set form = datagrid.filterFormView %}
{% set route = app.request.attributes.get('_route') %}

{% block body %}
    <table class="table">
        <thead>
            <tr id="filters">
                {{ form_start(form) }}
                <td>
                    {{ form_widget(form.title) }}
                </td>
                <td class="text-right">
                    <button class="btn btn-primary">{{ 'Filter' }}</button>
                    <a href="{{ datagrid.resetPath(route) }}" class="btn btn-secondary">{{ 'Reset' }}</a>
                </td>
                {{ form_end(form) }}
            </tr>
            <tr>
                <th>{{ 'Title' }}</th>
                <th>{{ 'Description' }}</th>
            </tr>
        </thead>
        <tbody>
            {% for video in datagrid.results %}
                <tr>
                    <td>{{ video.title }}</td>
                    <td>{{ video.description }}</td>
                </tr>
            {% else %}
                <tr>
                    <td colspan="2">{{ 'No video' }}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
    <div class="row">
        <div class="col-md-4"></div>
        <div class="col-md-4">
            {% include '@DoctrineDatagrid/Datagrid/pagination_info.html.twig' %}
        </div>
        <div class="col-md-4">
            {% include '@DoctrineDatagrid/Datagrid/pagination.html.twig' %}
        </div>
    </div>
{% endblock %}

Credit

Our special thanks go to ...


All versions of doctrine-datagrid-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
csanquer/colibri-csv Version 1.2.*
doctrine/orm Version ^2.2|^3.0
symfony/form Version ^7.0|^8.0
symfony/http-foundation Version ^7.0|^8.0
symfony/routing Version ^7.0|^8.0
symfony/config Version ^7.0|^8.0
symfony/http-kernel Version ^7.0|^8.0
webmozart/assert Version ^2.1.2
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 spyrit/doctrine-datagrid-bundle contains the following files

Loading the files please wait ...