ocubom / twig-extra-bundle
A Symfony bundle for custom extra Twig extensions
Installs: 230
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- symfony/config: ^5.4 || ^6.0 || ^7.0
- symfony/dependency-injection: ^5.4 || ^6.0 || ^7.0
- symfony/http-kernel: ^5.4 || ^6.0 || ^7.0
- symfony/twig-bundle: ^5.4 || ^6.0 || ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: *
- ocubom/twig-html-extension: ^1.0 || ^2.0
- ocubom/twig-svg-extension: ^1.0 || ^2.0
- symfony/phpunit-bridge: ^6.1 || ^7.0
- symfony/webpack-encore-bundle: ^1.16 || ^2.0
README
Ocubom Twig Extra Bundle
A Symfony bundle for custom extra Twig extensions.
Contents
About Twig Extra Bundle
Ocubom Twig Extra Bundle is a Symfony Bundle that allows the use of several custom Twig extensions with almost no configuration. This suite started as an internal class based on nochso/html-compress-twig to allow the use of wyrihaximus/html-compress with Twig 3.0. This class used to be embedded into several projects. Over time, each project slightly adapted its version, resulting in fragmented development and difficult maintenance. Therefore, the development is unified in an extension which is made public in case it is useful for other projects.
Along with the extension a bundle was created to easily integrate it into a Symfony project. The bundle evolves to configure other developed extensions, following the twig/extra-bundle philosophy.
Getting Started
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
composer require ocubom/twig-extra-bundle
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
composer require ocubom/twig-extra-bundle
You must also install the Twig extensions to be used:
composer require ocubom/twig-html-extension composer require ocubom/twig-svg-extension
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php
file of your project:
// config/bundles.php return [ // ... Ocubom\TwigExtraBundle\OcubomTwigExtraBundle::class => ['all' => true], ];
Usage
Just create the file config/packages/ocubom_twig_extra.yaml
using the configuration reference:
bin/console config:dump-reference ocubom_twig_extra
Or you can use the example configuration provided.
Note This configuration will be installed if your project uses endroid/installer
Roadmap
See the open issues for a full list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project.
- Create your Feature Branch (
git checkout -b feature/your-feature
). - Commit your Changes (
git commit -m 'Add your-feature'
). - Push to the Branch (
git push origin feature/your-feature
). - Open a Pull Request.
Authorship
- Oscar Cubo Medina — https://ocubom.page
See also the list of contributors who participated in this project.
License
Distributed under the MIT License. See LICENSE for more information.