Download the PHP package markup/twig-extension-proxy-bundle without Composer

On this page you can find all versions of the php package markup/twig-extension-proxy-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 twig-extension-proxy-bundle

TwigExtensionProxyBundle

A Symfony bundle that can provide lazy access to simpler, more common kinds of registered Twig extensions.

Build Status

Why this bundle?

In a typical application using Twig, all extension services need to be instantiated to be added to a Twig environment even if a small minority of extensions will actually be used in any given execution. In a large application, the number of Twig extensions instantiated in this way can become excessive, causing mushrooming memory usage and slowdowns.

For Twig extensions that only declare functions, filters and tests into the Twig environment, this bundle provides a mechanism by which these extensions can be used lazily within a Symfony-based application.

How to use

Typically, a Twig extension will be declared into an application using a service definition such as the following:

By default, Symfony's TwigBundle will then ensure that my_extension will be added to the twig environment service.

As long as the my_extension extension adheres to the following rules:

  1. the extension must only declare functions, filters and tests, and must instantiate them independently of any injected dependencies
  2. the options for the functions, filters and tests must themselves not be dependent on injected dependencies

then it can be declared as a proxied extension instead.

The same functional effect as above can be achieved by the following declaration:

With this example, any functions, filters or tests will still be declared into the twig environment, but the extension object itself will only be instantiated (and therefore, my_heavy_dependency will itself only be instantiated) once one of these Twig functors are actually used.

Grouped proxies

In cases where it is useful for Twig extensions to be arranged into groups of proxies (in order to sandbox certain extensions to particular areas of an application), extension services can be tagged with the optional "groups" option. The default group is "default", so to declare additional groups on top of this there should be a comma-separated list in the tag declaration.

The following is the above extension service declaration but declaring in addition a group named "custom":

This custom proxy extension can then be accessed with the service ID markup_twig_extension_proxy.proxy.custom. Typically this would then be added to a manually-declared Twig environment.

Proxying third-party extensions

With the bundle configuration:

an application will opt into converting any service tagged twig.extension into a proxied extension instead (if the extension is compatible, otherwise it will be included in the normal manner).

If you are using a version of Symfony prior to Symfony 3.2, you may need to list this bundle right near the top of your Symfony app kernel in order to convert other extensions. (The compiler pass that achieves this has a priority of 100.)

Known issues

Named arguments are not supported at the current time - unfortunately these are only caught at template compilation time not application compilation time, so please watch out for that!


All versions of twig-extension-proxy-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
twig/twig Version ^2
symfony/framework-bundle Version ^2.8|^3|^4
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 markup/twig-extension-proxy-bundle contains the following files

Loading the files please wait ....