PHPackages                             nowo-tech/console-debug-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. [CLI &amp; Console](/categories/cli)
4. /
5. nowo-tech/console-debug-bundle

ActiveSymfony-bundle[CLI &amp; Console](/categories/cli)

nowo-tech/console-debug-bundle
==============================

Symfony bundle that mirrors cdbg() calls to the browser console for authorized users, even in production.

v1.0.9(3w ago)09MITPHPPHP &gt;=8.1 &lt;8.6CI passing

Since Jul 9Pushed 2d agoCompare

[ Source](https://github.com/nowo-tech/ConsoleDebugBundle)[ Packagist](https://packagist.org/packages/nowo-tech/console-debug-bundle)[ Docs](https://github.com/nowo-tech/ConsoleDebugBundle)[ RSS](/packages/nowo-tech-console-debug-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (29)Versions (11)Used By (0)

Console Debug Bundle
====================

[](#console-debug-bundle)

[![CI](https://github.com/nowo-tech/ConsoleDebugBundle/actions/workflows/ci.yml/badge.svg)](https://github.com/nowo-tech/ConsoleDebugBundle/actions/workflows/ci.yml) [![Packagist Version](https://camo.githubusercontent.com/8dbd9b6020fba41fb280f058fdf423bd32b93970464b57d983621932d75f1047/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f776f2d746563682f636f6e736f6c652d64656275672d62756e646c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/nowo-tech/console-debug-bundle) [![Packagist Downloads](https://camo.githubusercontent.com/0c66c17e51de1061272e70dd9c72da48904c03d4cb136288e44df0a1c37f5ef3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f776f2d746563682f636f6e736f6c652d64656275672d62756e646c652e737667)](https://packagist.org/packages/nowo-tech/console-debug-bundle) [![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE) [![PHP](https://camo.githubusercontent.com/8e58b490725ac49cc8e463c473173681b324c9d92d7854275a785db013ca3de7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3737374242343f6c6f676f3d706870)](https://php.net) [![Symfony](https://camo.githubusercontent.com/3db9767565eebe4677a1af36a4a41db55f2d39a9b66ba0bb63a3ca290941c15d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d36253242253230253743253230372e34253230253743253230382e30253230253743253230382e312532422d3030303030303f6c6f676f3d73796d666f6e79)](https://symfony.com) [![GitHub stars](https://camo.githubusercontent.com/678e0c2e615d484562b6e6b0aa596f9cae61b242f84fd41b548562cc6ac2a98d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6e6f776f2d746563682f636f6e736f6c652d64656275672d62756e646c652e7376673f7374796c653d736f6369616c266c6162656c3d53746172)](https://github.com/nowo-tech/ConsoleDebugBundle) [![Coverage](https://camo.githubusercontent.com/cd0704b56f1d56def350b6d0164316307bb2f47834225fd85443b6fb0059bc73/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d3130302532352d627269676874677265656e)](#tests-and-coverage)

> ⭐ **Found this useful?** [Install from Packagist](https://packagist.org/packages/nowo-tech/console-debug-bundle) · Give it a **star** on [GitHub](https://github.com/nowo-tech/ConsoleDebugBundle) so more developers can find it.

**Console Debug Bundle** — Production-safe browser console debugging with **`cdbg()`**, similar in spirit to Symfony's `dd()` but non-blocking: it collects file, line, and variable data server-side and injects a `` that prints grouped `console.log()` output for authorized users only. Tested on Symfony **7.4**, **8.0**, and **8.1** (also compatible with Symfony 6.x and 7.0–7.3) · PHP 8.1+ (Symfony 8.x requires PHP 8.4+).

[![FrankenPHP Friendly Worker Mode](docs/images/frankenphp-friendly.png)](docs/images/frankenphp-friendly.png)

This bundle is **FrankenPHP worker mode friendly**.

Features
--------

[](#features)

- **`cdbg()` helper** — Drop-in debug calls anywhere in PHP; execution continues (no dump-and-die).
- **Role-gated** — Only authenticated users with configured roles see output, even in production.
- **Rich context** — Captures caller file, line, optional label, and normalized variable payloads.
- **HTML injection** — Appends a JSON payload and runner script before `` on HTML responses.
- **Custom gate service** — Replace or extend authorization with route/query-param logic.

Installation
------------

[](#installation)

```
composer require nowo-tech/console-debug-bundle
```

With **Symfony Flex**, the recipe registers the bundle and adds config. Without Flex, see [docs/INSTALLATION.md](docs/INSTALLATION.md).

**Manual registration** in `config/bundles.php`:

```
return [
  // ...
  Nowo\ConsoleDebugBundle\NowoConsoleDebugBundle::class => ['all' => true],
];
```

Grant a debug role to trusted users:

```
security:
  role_hierarchy:
    ROLE_CONSOLE_DEBUG: ROLE_USER
```

Requirements
------------

[](#requirements)

- PHP `>=8.1` (&lt;8.6); **Symfony 8.0** and **8.1** require **PHP 8.4+**
- Symfony **7.4**, **8.0**, or **8.1** (minimum supported minors; also works on Symfony 6.x and 7.0–7.3 via `composer.json` constraints)
- `symfony/security-bundle` (or equivalent) in your application for role-based gates

Configuration
-------------

[](#configuration)

```
nowo_console_debug:
  enabled: true
  roles:
    - ROLE_CONSOLE_DEBUG
  console_method: log
  label_prefix: '[cdbg]'
  shorten_paths: true
  query_param: console_debug
  # gate_service: App\ConsoleDebug\AppConsoleDebugGate
```

Usage
-----

[](#usage)

```
use function Nowo\ConsoleDebugBundle\cdbg;

public function show(Request $request): Response
{
    cdbg('items snapshot', $items, $request->query->all());

    return $this->render('page.html.twig', ['items' => $items]);
}
```

Open DevTools → Console on the rendered HTML page. Each `cdbg()` call appears as an expanded group with file, line, and values.

### Twig (requires `twig/twig`)

[](#twig-requires-twigtwig)

Same behaviour as Symfony's native `dump`, but output goes to the browser console:

```
{# full Twig context (macros/templates excluded), like {% dump %} #}
{% cdbg %}

{# one or more variables, like {{ dump(user) }} #}
{{ cdbg(user) }}
{% cdbg user, items %}
```

When called empty, the label is `twig context` and the template name/line is used as the source location.

Demo
----

[](#demo)

- `demo/symfony8` — Symfony **8.1** (PHP **8.5**), host port **8011** by default

Each demo runs **FrankenPHP + Caddy** in Docker (`FRANKENPHP_MODE=worker` by default). Login as `debugger / debug` and visit `/debug` to see `cdbg()` in the browser console. See [docs/DEMO-FRANKENPHP.md](docs/DEMO-FRANKENPHP.md).

Global demo commands: `make -C demo help` (e.g. `make -C demo up-symfony8`).

Development
-----------

[](#development)

```
make up
make install
make test
make cs-check
make phpstan
make release-check
```

Documentation
-------------

[](#documentation)

- [Installation](docs/INSTALLATION.md)
- [Configuration](docs/CONFIGURATION.md)
- [PSR evaluation (REQ-CS-007)](docs/PSR.md)
- [Usage](docs/USAGE.md)
- [Contributing](docs/CONTRIBUTING.md)
- [Code of Conduct](CODE_OF_CONDUCT.md)
- [Changelog](docs/CHANGELOG.md)
- [Upgrading](docs/UPGRADING.md)
- [Release](docs/RELEASE.md)
- [Security](docs/SECURITY.md)
- [Engram](docs/ENGRAM.md)
- [Spec-driven development](docs/SPEC-DRIVEN-DEVELOPMENT.md)
- [GitHub Spec Kit](docs/SPEC-KIT.md)

### Additional documentation

[](#additional-documentation)

- [Performance](docs/PERFORMANCE.md)
- [Demo (FrankenPHP)](docs/DEMO-FRANKENPHP.md)
- [GitHub CI notes](docs/GITHUB_CI.md)

Tests and coverage
------------------

[](#tests-and-coverage)

- Tests: PHPUnit (PHP)
- PHP: 100%

License and author
------------------

[](#license-and-author)

MIT · [Nowo.tech](https://nowo.tech) · [Héctor Franco Aceituno](https://github.com/HecFranco)

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance98

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.8% 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 ~3 days

Total

10

Last Release

21d ago

### Community

Maintainers

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

---

Top Contributors

[![HecFranco](https://avatars.githubusercontent.com/u/24323276?v=4)](https://github.com/HecFranco "HecFranco (28 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (3 commits)")

---

Tags

browserconsoledebugfrankenphpphpproductionsymfonysymfony-bundletwigconsolesymfonybrowserdebugdumpSymfony Bundleproductiondd

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nowo-tech-console-debug-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nowo-tech-console-debug-bundle/health.svg)](https://phpackages.com/packages/nowo-tech-console-debug-bundle)
```

###  Alternatives

[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k190.0M2.6k](/packages/symfony-security-bundle)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.3M433](/packages/easycorp-easyadmin-bundle)[contao-community-alliance/dc-general

Universal data container for Contao

1581.4k93](/packages/contao-community-alliance-dc-general)

PHPackages © 2026

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