ocubom/twig-extra-bundle

A Symfony bundle for custom extra Twig extensions

v1.5.0 2023-12-07 10:22 UTC

This package is auto-updated.

Last update: 2024-11-02 11:58:58 UTC


README

Ocubom Twig Extra Bundle

A Symfony bundle for custom extra Twig extensions.

Contributors Forks Stargazers Issues License

Version CI Code Quality Coverage

Explore the docs »

Report Bug · Request Feature

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

  1. Fork the Project.
  2. Create your Feature Branch (git checkout -b feature/your-feature).
  3. Commit your Changes (git commit -m 'Add your-feature').
  4. Push to the Branch (git push origin feature/your-feature).
  5. Open a Pull Request.

Authorship

See also the list of contributors who participated in this project.

License

Distributed under the MIT License. See LICENSE for more information.