PHPackages                             jlchassaing/facetbundle - 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. [Search &amp; Filtering](/categories/search)
4. /
5. jlchassaing/facetbundle

ActiveEzplatform-bundle[Search &amp; Filtering](/categories/search)

jlchassaing/facetbundle
=======================

GieFacetBundle helps is a set of helpers to create search Facets, and perform sorl queries with those facets

v1.0(5y ago)11911MITPHPPHP &gt;=7.1CI failing

Since May 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/jlchassaing/facetbundle)[ Packagist](https://packagist.org/packages/jlchassaing/facetbundle)[ RSS](/packages/jlchassaing-facetbundle/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (4)Versions (17)Used By (0)

[![Build Status](https://camo.githubusercontent.com/6de9492f47c698472bc124454ef09ff931ef5545266a144f9e48dee158df4f1e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a6c636861737361696e672f666163657462756e646c652e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/jlchassaing/facetbundle)[![Code Coverage](https://camo.githubusercontent.com/f2743eeb4e8de338031045dc30f5a07f8edc1bcbb3c920a77fb5d085507c0ab3/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6a6c636861737361696e672f666163657462756e646c652e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/jlchassaing/facetbundle)[![Latest stable](https://camo.githubusercontent.com/5b91d7e2fa15163fb3a7bd62336085ad8566319ac0d47bcf1e4f85e5868eebeb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6c636861737361696e672f666163657462756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jlchassaing/facetbundle)[![License](https://camo.githubusercontent.com/73bfe2bc7438246457a2d8ae23f6ab3b31baf542fc445a1eb4221621246189dc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a6c636861737361696e672f666163657462756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jlchassaing/facetbundle)

Gie Facet Bundle
================

[](#gie-facet-bundle)

This bundle will help you perform and retreive facet searches.

how to use it
-------------

[](#how-to-use-it)

### 1. Init the facet search helper

[](#1-init-the-facet-search-helper)

In your Controller action just call the gie.facet.search.helper

By default two facet search helpers are set in this bundle :

- the ContentTypeFacetSearchHelper who's alias is content\_type
- thie TagsFacetSearchHelper who's alias is tags and is based on the netgen/tagsbundle

after calling the facet search helper, you'll have to call the init method with two parameter :

- an array with facet FacetConfig objects
- the current Request

FacetCongig objects are build with the facet helper alias a title and an array of facet parameters

The solr\_field facet can facet the query on any solr field defined by the field parameter. The format function can help format the value of user display

The init method will also look at the queryString and init the selected facets. If you don't want it to do so, you can avoid passing it the request object. And then use de setFacetFilters() method to set what ever selected facet you want.

```
$facetSearchHelper = $this->container->get('gie.facet.search.helper')
                                     ->init(new FacetConfig('Content types',
                                                             ContentTypeFacetSearchHelper::class,
                                                             [
                                                            'minCount' => 2,
                                                            'limit' => 5,
                                                            ]),
                                            new FacetConfig('Key Words',
                                                             TagFacetSearchHelper::class,
                                                             [
                                                            'minCount' => 1,
                                                            'limit' => 5,
                                                            ]),
                                            new FacetConfig('custom_date',
                                                            'Publication date'),
                                            new FacetConfig('solr_field',
                                                            'Year',
                                                            ['field' => 'meta_year_date_dt',
                                                             'format' => function($value){
                                                             $date = new \DateTime($value);
                                                             return $date->format('Y');}
                                                            ]),
            ], $request);
```

### 2. Build query

[](#2-build-query)

once done, build your query without any facet or filter condition and pass it down to the facet helper.

```
 $query = $facetSearchHelper->addQueryFacets($query);
```

### 3. get the facet array that will be sent to the template

[](#3-get-the-facet-array-that-will-be-sent-to-the-template)

After updating the query with the facet settings and the filters from the eventually selected facets, you need to call the getFacets method to get the facets array.

#### 1. Using PagerFanta

[](#1-using-pagerfanta)

If you need the PagerFanta tool then you can pass it to the facetHelper.

When using PagerFanta, you'll have to use the bundle ContentSearchAdapter otherwise you won't be able to get the facets from the query beeing executed.

```
use Gie\FacetBuilder\Pagination\Pagerfanta\ContentSearchAdapter;
```

```
$facets = $facetSearchHelper->getFacetsFromPager($pager);
```

#### 2. From a QueryResult

[](#2-from-a-queryresult)

If you are just using a ContentQuery then you can pass the result to the facetHelper and call the

```
$facets = $facetHelper->getFacetsFromQuery($queryResult);
```

#### 4. pass the facets to the template

[](#4-pass-the-facets-to-the-template)

Last thing you'll have to do is retrieve the facets array that you'll pass to the template to display them as you want.

```
array:2 [▼
  "Facet Name" => array [▼
    0 => array [▼
      "name" => "Facet Value Name"
      "key" => "facet_generate_key"
      "count" => count
      "querystring" => "querystring" /* query string to add to the request */
      "selected" => true|false
    ]
    .../...
  ]
]
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

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

###  Release Activity

Cadence

Every ~64 days

Recently: every ~94 days

Total

14

Last Release

2114d ago

Major Versions

v0.6.2 → v1.02020-09-15

PHP version history (4 changes)0.1PHP ^5.6|^7.1

v0.4.1PHP ^5.6|^7.0

v0.4.2PHP ^5.6||^7.0

v0.5PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/820841?v=4)[jlchassaing](/maintainers/jlchassaing)[@jlchassaing](https://github.com/jlchassaing)

---

Top Contributors

[![jlchassaing](https://avatars.githubusercontent.com/u/820841?v=4)](https://github.com/jlchassaing "jlchassaing (70 commits)")[![SofLesc](https://avatars.githubusercontent.com/u/10260380?v=4)](https://github.com/SofLesc "SofLesc (3 commits)")

---

Tags

tagsezpublishfacetsezplatform

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jlchassaing-facetbundle/health.svg)

```
[![Health](https://phpackages.com/badges/jlchassaing-facetbundle/health.svg)](https://phpackages.com/packages/jlchassaing-facetbundle)
```

###  Alternatives

[netgen/admin-ui-bundle

Netgen Admin UI implements an alternate administration UI for eZ Platform, based on eZ Publish Legacy administration interface

3325.5k4](/packages/netgen-admin-ui-bundle)[netgen/information-collection-bundle

Information collection alike feature for Ibexa Platform

1945.6k11](/packages/netgen-information-collection-bundle)[digital-creative/nova-pill-filter

A Laravel Nova filter that renders into clickable pills.

1660.5k1](/packages/digital-creative-nova-pill-filter)[netgen/remote-media-bundle

Remote media field type implementation

189.5k6](/packages/netgen-remote-media-bundle)

PHPackages © 2026

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