djboris88/timber-debugger

Composer package which provides some extra debugging options for Timber

1.1.0 2019-12-11 09:07 UTC

This package is auto-updated.

Last update: 2024-11-11 20:26:28 UTC


README

Package which provides some extra debugging options for Timber

Installation

To install the latest stable version of this component, open a console and execute the following command:

composer require djboris88/timber-debugger

Usage

These extensions are only active when WP_DEBUG is defined and set to true. Twig Extensions will automatically be registered and applied.

Commented Include

Package: djboris88/twig-commented-include (GitHub, Packagist)

This is a simple Twig Extension which helps debugging and navigating through many Twig partials in your project. It outputs a HTML comments before and after each include statement while rendering the template. Comments look like this:

<!-- Begin output of "_partials/_navigation.twig" -->
<div class="navigation" role="navigation" data-navigation>...</div>
<!-- / End output of "_partials/_navigation.twig" -->

Dump extension

Package: hellonico/twig-dump-extension (GitHub, Packagist)

Standalone Symfony Var Dumper Twig extension. Add {{ dump() }} in your twig templates to see it in action.

{{ dump(foo) }}
{% dump foo %}
{% dump foo, bar %}

Twig Breakpoints

Package : ajgl/breakpoint-twig-extension (GitHub, Packagist)

This component allows you set breakpoints in twig templates.
Requires the Xdebug PHP extension to be installed.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>title</title>
  </head>
  <body>
    {{ breakpoint() }}
  </body>
</html>

Once stopped, your debugger will allow you to inspect the $environment and $context variables.

Function arguments
Any argument passed to the twig function will be added to the $arguments array, so you can inspect it easily.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>title</title>
  </head>
  <body>
    {{ breakpoint(app.user, app.session) }}
  </body>
</html>

License

This component is under the GPL 3.0 license. See the complete license in the LICENSE file.

Reporting an issue or a feature request

Issues and feature requests are tracked in the Github issue tracker.

Author Information

Developed with ♥ by Boris Đemrovski.

If you find this component useful, please add a ★ in the GitHub repository page and/or the Packagist package page.