Download the PHP package andrew72ru/bitrix-twig without Composer

On this page you can find all versions of the php package andrew72ru/bitrix-twig. 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 bitrix-twig

BITRIX/TWIG

Module for rendering twig templates in bitrix framework

rus

Intro

Bitrix framework allows render content with third-party template engines, in particular, twig.

To implement this, bitrix required a global (sic!) array $arCustomTemplateEngines with next structure:

The templateExt key describes extensions of template files, and in function key of this array contains the global (sic!) function name, which implement the render of template.

Also, function must instantiate the template engine class and echo (yes, fucking echo, not return!) the result of rendering.

If you even feel headache because of this, wait a minute, this is not all.

Installation

You MUST use the composer autoloader in application init. You site MUST use utf-8 codepage.

To install module, simple run

Module will be stored in you vendor, register it classes and functions.

Configuration

Default configuration:

You may override or extend this configuration in bitrix/.settings.php file. The configuration key is twigRenderer. You config may be like this:

Usage

Simple place the file <component_template_name>.thml.twig (or <component_template_name>.twig) to you template folder, instead of <component_template_name>.php. All html-markup and twig functions / filters will be processed by twig engine. Module implement some custom functions to integrate template engine and bitrix framework (see below).

Custom twig variables functions

Global variables:
Custom functions

All of this the same bitrix framework functions.

Variables in template

Events

The module call the onAfterTwigEngineInit event after initialization. You may use it for add you own functions / filters / extensions.

Tests

Now the test contains a minimal (example) test, because of bitrix framework not have a psr autoloader, service container and other framework-must-have thinks. Tests are possible only if you have installed framework, installed module and at least one template, renders by this module.

If you know how to make test for all of classes — you welcome.


All versions of bitrix-twig with dependencies

PHP Build Version
Package Version
Requires twig/twig Version ^1.35
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 andrew72ru/bitrix-twig contains the following files

Loading the files please wait ....