PHPackages                             pdfloresjdav/avlist-bundle - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. pdfloresjdav/avlist-bundle

ActiveSymfony-bundle[PDF &amp; Document Generation](/categories/documents)

pdfloresjdav/avlist-bundle
==========================

Symfony AvListBundle

02.5k↓75%PHP

Since Aug 8Pushed 6y agoCompare

[ Source](https://github.com/pdfloresjdav/AvListBundle)[ Packagist](https://packagist.org/packages/pdfloresjdav/avlist-bundle)[ RSS](/packages/pdfloresjdav-avlist-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

AvListBundle
============

[](#avlistbundle)

Easily make paginate and orderable list in Symfony2

1. Install

---

Add this in your composer :

```
"appventus/avlist-bundle": "dev-master"
"pdfloresjdav/avlist-bundle": "dev-master"

```

2. How to use it ?

---

a) Controller
-------------

[](#a-controller)

This is a classic action to list an entity :

```
use Symfony\Component\HttpFoundation\Request;

class FooController extends Controller
{
    /**
     * Lists all Foo entities.
     *
     */
    public function indexAction(Request $request)
    {
        $em = $this->getDoctrine()->getEntityManager();
        $qb = $em->getRepository(MyBundle:Foo)->findAll();

        // Create an AvList
        $list = $this->get('av_list')->getList($qb, null, array(
            'max_per_page' => 20,
        ));

        $list->addColumn('title', null, 'myList.column.title', true, 'entity.title');
        $list->addColumn('startDate', array(array("name" => "date", "params" => array('d/m/Y'))), 'myList.column.startDate', true, 'entity.startDate');

        return array(
            'list' => $list,
        );

        if ($this->get('request')->isXmlHttpRequest()) {
            return $this->render($list->getTemplate(), array(
                'list' => $list,
            ));
        } else {
            return array(
                'list' => $list,
            );
        }
    }
}

```

The addColunmn allow you to add/define the columns to display in the list. In order :

- 1. You can define the field to display
- 2. Is there some special Twig filters to use on the variable to display correctly ?
- 3. The label (th)
- 4. Do we may sort on this column ?
- 5. If so, on which field

b) View (optional):
-------------------

[](#b-view-optional)

If you want to override default views, you'll have to write an index with the layout, and a partial witch just contain the list:

index.html.twig :

```
{% extends "MyBundle::layout.html.twig" %}

{% block content %}
    Foo list
    {% include 'MyBundle:Foo:indexPartial.html.twig' with {'list':list}%}
{% endblock %}

```

Yeah, it's pretty minimalist, but it's very important.

And now our Partial :

```
{% if list.pager.nbResults > 0 %}

                    Name
                    Price
                    Description

                {% for foo in list.pager %}

                        {{ foo.name }}
                        {{ foo.price }}
                        {{ foo.name }}

                {% endfor %}

        {% include 'AvListBundle:AvList:control.html.twig' with {'list':list}%}

{% else %}
    No Foos :(
{% endif %}

```

And voila !

3. How it works ?

---

In the partial view, you set on the th tag a class sortable and an id with the value of the field you want to search on. In our exemple, the entity Foo has the alias "f" in the query builder, so to sort by Foo's name, you set the following th id: "f.name".

4. Options

---

This bundle use the PagerFanta bundle to build paginator, more specificly the TwitterBootstrapView. Options are available for this view, and you can pass them as second argument when you instanciate AvList:

```
$list = $this->get('av_list');
$list->addOption("proximity", 3);
$list->addOption("previous_message", "Précédent");

```

Please refer to [PagerFanta](https://github.com/whiteoctober/Pagerfanta/blob/master/README.md) doc for more information

5. Multiple list in a page

---

If you need to have several lists components in a single page, you will have to define the route option (to specify a different url to call that the request one). Optionnally and if your route requires params, you obviously may pass an array through the route\_parameters option. Also, you won't be able to use the av\_list service because of a singleton pattern issue (if you use the service, you always will use the same object and so on, you will overwrite the values instead of create a new list.

```
/**
 * Lists all Help\FaqItem entities.
 *
 * @Route("/", name="admin_myentity_list")
 * @Route("/ajax/cat/{id}", name="ajax_admin_myentity_list_by_category")
 * @Method("GET")
 * @Template()
 */
public function indexAction($id = null)
{
    $categories = Your_function();
    foreach ($categories as $key => $category) {
        $list = new AvList($request, $this->get('templating'));
        $list->setQueryBuilder($em->getRepository('MyBundle:MyEntity')->createQueryBuilder('e')->where('e.category = :category')->setParameter('category', $category));
        $list->setTemplate($partialTemplate);
        $list->setOptions(array(
                'route'            => 'ajax_admin_myentity_list_by_category',
                'route_parameters' => array('id' => $category->getId()),
                'theme'            => 'range',
                'maxPerPage'       => 5,
                'container_class'  => $category->getId().'-myentity-list',
                'container_id'     => $category->getId().'-myentity-list'
        ));
        $params["lists"][$category->getId()] = $list;
    }
}

```

6. Custom control theme

---

By default, AvList provides one theme : range. This theme adds the basics actions to get something like this : &lt;- \[10,20\] on 100 -&gt;

If you want to, you can create your own theme by setting your theme name as "theme" option and to put it in the app/Resources/AvListBundle/views/AvList/yourCustomThemeFileName.html.twig

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ba4aea43b38cf2ce410e99e1bb6c19967a52438c7bf1ceb15b5e7f890625eedc?d=identicon)[pdfloresj](/maintainers/pdfloresj)

---

Top Contributors

[![pdfloresjdav](https://avatars.githubusercontent.com/u/31741062?v=4)](https://github.com/pdfloresjdav "pdfloresjdav (4 commits)")

### Embed Badge

![Health badge](/badges/pdfloresjdav-avlist-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/pdfloresjdav-avlist-bundle/health.svg)](https://phpackages.com/packages/pdfloresjdav-avlist-bundle)
```

###  Alternatives

[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

13.9k293.5M1.3k](/packages/phpoffice-phpspreadsheet)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[smalot/pdfparser

Pdf parser library. Can read and extract information from pdf file.

2.7k34.5M216](/packages/smalot-pdfparser)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.1k57.6M131](/packages/openspout-openspout)[keboola/csv

Keboola CSV reader and writer

1451.8M21](/packages/keboola-csv)

PHPackages © 2026

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