PHPackages                             constant-exposure/constant-exposure-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. constant-exposure/constant-exposure-bundle

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

constant-exposure/constant-exposure-bundle
==========================================

Expose php constants to front.

v2.4.0(2y ago)42.4k[1 PRs](https://github.com/adpeyre/constant-exposure-bundle/pulls)MITPHPPHP &gt;=7.2CI failing

Since Feb 14Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/adpeyre/constant-exposure-bundle)[ Packagist](https://packagist.org/packages/constant-exposure/constant-exposure-bundle)[ RSS](/packages/constant-exposure-constant-exposure-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (9)Dependencies (11)Versions (19)Used By (0)

Constant Exposure Bundle
========================

[](#constant-exposure-bundle)

[![Version](https://camo.githubusercontent.com/e019433b60052e17ca0bdb197a27fcf6c6182a4ec755b4cfb5066b81195cf91c/68747470733a2f2f706f7365722e707567782e6f72672f636f6e7374616e742d6578706f737572652f636f6e7374616e742d6578706f737572652d62756e646c652f76657273696f6e)](//packagist.org/packages/constant-exposure/constant-exposure-bundle)[![License](https://camo.githubusercontent.com/06308ad321aa856e2f97f59b2ba040f6da175a74181dd0146ebc0ffae1bea9ad/68747470733a2f2f706f7365722e707567782e6f72672f636f6e7374616e742d6578706f737572652f636f6e7374616e742d6578706f737572652d62756e646c652f6c6963656e7365)](//packagist.org/packages/constant-exposure/constant-exposure-bundle)

This **Symfony Bundle** is useful if you need to expose constants to front.

Install
-------

[](#install)

### Composer

[](#composer)

`composer require constant-exposure/constant-exposure-bundle:^2.2`

### Load the bundle

[](#load-the-bundle)

In `config/bundles.php`, add this line:

```
return [
    ...
    ConstantExposureBundle\ConstantExposureBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

### Define constants to expose

[](#define-constants-to-expose)

Create a file `config/packages/constant_exposure.yaml` in your project. Then, configure constants to expose.

```
constant_exposure:
    parameter:
        debug: '%kernel.debug%'
        sentry_dsn: '%env(SENTRY_DSN)%'
        password_expire: !php/const App\Entity\Password::EXPIRE_PASSWORD
```

### Use constants in JavaScript

[](#use-constants-in-javascript)

Add this line in your Twig template. Pass as parameter a name for your JavaScript object.

```
{{ constant_exposure_object('ConstantExposure') }}
```

Get them in Javascript:

```
ConstantExposure.getParameter(PARAMETER_NAME [, DEFAUlT_VALUE = null] );
```

```
// Check if you are in debug mode
const isDebug = ConstantExposure.getParameter('debug');

// If sentry_dsn is not defined, default value is an empty string
const sentryDsn = ConstantExopsure.getParameter('sentry_dsn', '');
```

### Route exposure

[](#route-exposure)

If you need to expose your constants on a route, add these lines in your routing file:

```
constant_exposure:
    resource: "@ConstantExposureBundle/Resources/config/routing.yaml"
```

Then, you can access it with this url:

- /constant-exposure.json for a **JSON** format
- /constant-exposure.xml for a **XML** format
- /constant-exposure.csv for a **CSV** format

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance51

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~243 days

Recently: every ~494 days

Total

10

Last Release

139d ago

Major Versions

v1.0.1 → v2.0.02020-03-28

PHP version history (2 changes)v1.0.0PHP &gt;=7.2

2.5.0.x-devPHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/constant-exposure-constant-exposure-bundle/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M572](/packages/shopware-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)

PHPackages © 2026

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