2017 © Pedro Peláez
 

symfony-bundle twig-object-dump

Simple Twig extension improving templates debugging

image

wizaplace/twig-object-dump

Simple Twig extension improving templates debugging

  • Friday, February 24, 2017
  • by mnapoli
  • Repository
  • 8 Watchers
  • 7 Stars
  • 14,189 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 11 % Grown

The README.md

Twig object dumper is a simple Twig extension improving templates debugging : it helps front-end developers to interact the right way with back-end objects., (*1)

Usage

With this code :, (*2)

class Product
{
    private $stockQuantity;

    public function isInStock() : bool
    {
        return $this->stockQuantity > 0;
    }
}

Standard Twig dump function displays :, (*3)

Product {#762 ▼
  -stockQuantity: 3
}

Which is not a good information : stockQuantity is private and not usable., (*4)

Whereas the new d function displays the right way to access object's properties :, (*5)

WizaTech\Product
    isInStock() : bool

Installation

$ composer require wizaplace/twig-object-dump

Don't forget to load the new bundle in the app/AppKernel.php :, (*6)

$bundles = [
    // ...
    new Wizaplace\TwigObjectDumpBundle\TwigObjectDumpBundle(),
];

This extension checks the twig environment and do nothing if it's set to debug., (*7)

Installation for dev

You can use Vagrant to setup a 'ready for dev' environment :, (*8)

$ cp Vagrantfile.dist Vagrantfile
$ vagrant up
$ vagrant ssh

Load dependencies with Composer :, (*9)

$ composer install

Coding Style

To ensure that you use the right coding standard, use coke :, (*10)

$ vendor/bin/coke

Credits

Developed by Wizaplace., (*11)

License

This project is licensed under the MIT license., (*12)

The Versions

24/02 2017

dev-master

9999999-dev

Simple Twig extension improving templates debugging

  Sources   Download

MIT

The Requires

 

The Development Requires

debug twig object dump

24/02 2017

v1.0.0

1.0.0.0

Simple Twig extension improving templates debugging

  Sources   Download

MIT

The Requires

 

The Development Requires

debug twig object dump