Search by

formatz / fz-hosting-symfony-bundle

formatz

FZ Hostings Symfony Bundle

Package info

gitlab.com/formatz/fz-hosting-symfony-bundle

Issues

Type:symfony-bundle

pkg:composer/formatz/fz-hosting-symfony-bundle

Statistics

Installs: 3 687

Dependents: 0

Suggesters: 0

Stars: 0

1.4.1 2026-11-19 15:44 UTC

This package is auto-updated.

Last update: 2026-11-20 08:28:57 UTC


README

Installation

Install the bundle with composer

composer require formatz/fz-hosting-symfony-bundle

If you don't have Symfony Flex

Add the package config to `config/packages`

# config/packages/formatz_fz_hosting.yaml
formatz_fz_hosting:
  api_key: '%env(resolve:FZ_HOSTING_API_KEY)%'
  api_endpoint: '%env(resolve:FZ_HOSTING_API_ENDPOINT)%'
  matomo:
    url: '%env(FZ_MATOMO_URL)%'
    site_id: '%env(FZ_MATOMO_SITE_ID)%'
    token: '%env(FZ_MATOMO_TOKEN)%'
    disable_cookies: true
    disable_browser_feature_detection: true

Add env variable to `.env`

FZ_HOSTING_API_ENDPOINT=https://hostings.format-z.ch
FZ_HOSTING_API_KEY=changeme
FZ_MATOMO_URL=
FZ_MATOMO_SITE_ID=
FZ_MATOMO_TOKEN=

Send current versions

php bin/console fz-hosting:send-current-versions

Matomo

The bundle can serve the Matomo tracker through a first-party proxy (/_fz/core.js and /_fz/sync), so ad blockers filtering the Matomo domain or the matomo.js / matomo.php names don't block the tracking. The token stays on the server.

Enable the routes

Import the routes of the bundle

# config/routes/formatz_fz_hosting.yaml
formatz_fz_hosting:
  resource: '@FormatzFzHostingBundle/Resources/config/routes.yaml'

If your firewall or access_control restricts the whole site, allow anonymous access to ^/_fz/.

Configure Matomo variables

Complete env variables in `.env`

FZ_MATOMO_URL=
FZ_MATOMO_SITE_ID=
FZ_MATOMO_TOKEN=

Matomo is disabled as long as the URL, the site ID or the token is empty: the proxy routes then return a 404 and nothing is added to the pages.

Insert the script

Add the Twig function in the <head> of your layout (it renders nothing when Matomo is disabled)

{{ fz_matomo_script() }}