Download the PHP package andanteproject/page-filter-form-bundle without Composer

On this page you can find all versions of the php package andanteproject/page-filter-form-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 page-filter-form-bundle

Andante Project Logo

Page Filter Form Bundle

Symfony Bundle - AndanteProject

Latest Version Github actions Framework Php7 PhpStan

A Symfony Bundle to simplify the handling of page filters for lists/tables in admin panels. ๐Ÿงช

Requirements

Symfony 4.x-7.x and PHP 7.4-8.0.

Features

How to install

After install, make sure you have the bundle registered in your symfony bundles list (config/bundles.php):

This should have been done automagically if you are using Symfony Flex. Otherwise, just register it by yourself.

The problem

Let's suppose you have this common admin panel controller with a page listing some Employee entities.

To add filters to this page, let's create a Symfony form.

Let's add this Form to our controller page:

The code above has some huge problems:

The solution with Page Filter Form

Use Andante\PageFilterFormBundle\Form\PageFilterType as parent of your filter form (why?) and implement target_callback option on your form elements like this:

Implement Andante\PageFilterFormBundle\PageFilterFormTrait in you controller (or inject an argument Andante\PageFilterFormBundle\PageFilterManagerInterface as argument) and use form like this:

โœ… Done!

"target_callback" option

target_callback

type: null or callable default: null

The callable is going to have 3 parameters (third is optional):

Parameter What Mandatory Description
1 Filter $target yes It's the second argument of createAndHandleFilter. It can be whatever you want: a query builder, an array, a collection, a object. It doesn't matter as long you match it's type with this argument sign.
2 form data yes Equivalent to call $form->getData() on the current context. It is going to be a ?string on a TextType or a ?\DateTime on a DateTimeType
3 form itself no It's the current $form itself.

Why use PageFilterType as from Parent

You could avoid to use Andante\PageFilterFormBundle\Form\PageFilterType as parent for your form, but be aware it sets some useful default you may want to replicate:

Option Value Description
method GET You probably want filters to be part of the URL of the page, don't you?
csrf_protection false You want the user to be able to share the URL of the page to another user without facing problems
allow_extra_fields true Allow other URL parameters outside your form values
andante_smart_form_attr true Enable form elements rendering wherever you want inside you page, even outside form tag while keeping them working properly (discover more).

Render the form in twig

As long as andante_smart_form_attr is true, you can render your form like this:

โœ… form.perPage element work properly even outside form tag (how?!).

Give us a โญ!

Built with love โค๏ธ by AndanteProject team.


All versions of page-filter-form-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
symfony/form Version ^4.0 || ^5.0 || ^6.0 || ^7.0
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 andanteproject/page-filter-form-bundle contains the following files

Loading the files please wait ....