Download the PHP package craue/twigextensions-bundle without Composer

On this page you can find all versions of the php package craue/twigextensions-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package twigextensions-bundle

Information

Build Status

TwigExtensionsBundle is a collection of useful Twig extensions for your Symfony project.

A live demo with code examples can is available at http://craue.de/symfony-playground/en/CraueTwigExtensions/.

DecorateEmptyValueExtension

Provides an enhanced default filter, craue_default, to decorate empty values with a placeholder which can even be HTML.

Usually, if you want to use HTML, e.g. the HTML entity —, as value for the default filter in an HTML Twig template you have to do cumbersome

to make it render properly. With this extension you can write

instead.

ArrayHelperExtension

Provides the filters

FormExtension

Provides a mechanism to render a form several times on one page. This is done by cloning the form prior to rendering using the craue_cloneForm function.

StringHelperExtension

Provides the craue_trailingDot filter for ensuring that a text ends with a dot. This comes in handy when using error messages (e.g. for validation) of vendor bundles (which are written like sentences but are missing the trailing dots) together with your own ones (which should include the trailing dot).

FormatDateTimeExtension

Provides the filters craue_date, craue_time, and craue_datetime for locale-aware formatting of date, time, and date/time values.

FormatNumberExtension

Provides the filters craue_number, craue_currency, and craue_spellout for locale-aware formatting of numbers and currencies.

ChangeLanguageExtension

Provides the functions craue_languageName and craue_availableLocales as well as a template for implementing a language change mechanism.

Installation

Get the bundle

Let Composer download and install the bundle by running

in a shell.

Enable the bundle

If you don't use Symfony Flex, register the bundle manually:

Or, for Symfony 3.4:

Examples to use the extensions in your Twig template

DecorateEmptyValueExtension

ArrayHelperExtension

FormExtension

StringHelperExtension

FormatDateTimeExtension

FormatNumberExtension

ChangeLanguageExtension

There's a Twig template provided which you can use to render a "change language" menu like this:

This will render a list of links to the current route in all defined languages. Wrap it in a div to style it via CSS. Take a look at the template if you want to customize it.

Set/override default values

DecorateEmptyValueExtension

FormatDateTimeExtension

FormatNumberExtension

ChangeLanguageExtension

You can also set the keys to be more specific about the locales:

Advanced stuff

Aliases

Optionally, you can define aliases for all provided filters/functions to be used within your project. This allows you to use names you prefer instead of the pre-defined ones. E.g., if you don't like to write

all the time, you may define an alias like d for the craue_default filter which allows you to write

in your Twig templates. But pay attention to not accidentally override built-in filters/functions, although you can do it intentionally.

DecorateEmptyValueExtension

ArrayHelperExtension

FormExtension

StringHelperExtension

FormatDateTimeExtension

FormatNumberExtension

ChangeLanguageExtension

Enabling only specific extensions

By default, all provided extensions are enabled. If you're using only one or some of them, you may want to disable the others. The following enables them all, so remove the ones you don't need:


All versions of twigextensions-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8
symfony/config Version ~4.4|~5.3|^6
symfony/dependency-injection Version ~4.4|~5.3|^6
symfony/twig-bundle Version ~4.4|~5.3|^6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package craue/twigextensions-bundle contains the following files

Loading the files please wait ....