Skip to content

Commit

Permalink
Updated Readme and adjusted project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
djboris88 committed Dec 3, 2018
1 parent f03832a commit 424e013
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 35 deletions.
76 changes: 73 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,80 @@

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.
`include` statement while rendering the template. Comments look like this:

All you need to do is add it to your project using Composer:
```html
<!-- Begin output of "_partials/_navigation.twig" -->
<div class="navigation" role="navigation" data-navigation>...</div>
<!-- / End output of "_partials/_navigation.twig" -->
```

```php
Installation
------------
To install the latest stable version of this component, open a console and execute the following command:
```bash
composer require djboris88/twig-commented-include --dev
```

Usage
-----
The first step is to register the extension into the twig environment
```php
/** @var $twig Twig_Environment */
$twig->addExtension(new Djboris88\Twig\Extension\CommentedIncludeExtension());
```

Once registered, it will automatically add the HTML comments before and after every `include` tag
in the Twig files.

Symfony Bundle
--------------

If you want to use this extension in your Symfony application, you can enable the
Symfony Bundle included in this package.

The bundle will register the twig extension automatically.

### Symfony 2/3

```php
// app/AppKernel.php
if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
$bundles[] = new Djboris88\Twig\Extension\CommentedIncludeTwigExtensionBundle();
}
```

### Symfony 4

```php
// config/bundles.php
//...
return [
//...
Djboris88\Twig\Extension\CommentedIncludeTwigExtensionBundle::class => ['dev' => true]
];
```

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].

[LICENSE]: LICENSE
[Github issue tracker]: https://github.com/djboris88/twig-include-comments/issues
[GitHub repository page]: https://github.com/djboris88/twig-include-comments
[Packagist package page]: https://packagist.org/packages/djboris88/twig-include-comments
61 changes: 29 additions & 32 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
{
"name": "djboris88/twig-include-comments",
"description": "Twig extension which outputs HTML comments before and after the `include` tag",
"keywords": ["twig", "html", "comments", "debug"],
"homepage": "https://github.com/djboris88/twig-include-comments",
"license": "GPL-3.0",
"authors": [
{
"name": "Boris Đemrovski",
"email": "djboris88@gmail.com",
"role": "developer"
}
],
"autoload": {
"psr-4": { "Djboris88\\Twig\\": "src/" }
},
"require": {
"php": ">=5.6",
"twig/twig": "^1.14|^2.0"
},
"require-dev": {
"symfony/framework-bundle": "^2.7|^3.2",
"symfony/twig-bundle": "^2.7|^3.2"
},
"suggest": {
"symfony/framework-bundle": "The framework bundle to integrate the extension into Symfony",
"symfony/twig-bundle": "The twig bundle to integrate the extension into Symfony"
},
"extra": {
"branch-alias": {
"dev-master": "0.3.x-dev"
}
}
"name": "djboris88/twig-commented-include",
"description": "Twig extension which outputs HTML comments before and after the `include` tag",
"keywords": ["twig", "html", "comments", "debug"],
"homepage": "https://github.com/djboris88/twig-include-comments",
"license": "GPL-3.0",
"authors": [
{
"name": "Boris Đemrovski",
"email": "djboris88@gmail.com",
"role": "developer"
}
],
"autoload": {
"psr-4": {
"Djboris88\\Twig\\": "src/"
}
},
"require": {
"php": ">=5.6",
"twig/twig": "^1.14|^2.0"
},
"require-dev": {
"symfony/framework-bundle": "^2.7|^3.2",
"symfony/twig-bundle": "^2.7|^3.2"
},
"suggest": {
"symfony/framework-bundle": "The framework bundle to integrate the extension into Symfony",
"symfony/twig-bundle": "The twig bundle to integrate the extension into Symfony"
}
}
File renamed without changes.

0 comments on commit 424e013

Please sign in to comment.