Download the PHP package filhocodes/twig-stack-extension without Composer

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

Twig Stack Extension

Composer Package Composer Package Downloads Build Status Coverage Status

This extension allows you to define a section of a "base template" that will receive contents from all the other pages, either via include, embed or extends.

The reason behind this package is that phive/twig-extensions-deferred doesn't really have the features I wanted. For those who doesn't know, this extension allows you to say that a block in your template will be evaluated at the end of the template, and not while it is parsing. It also serves as a learning project, since it is my first Twig Extension.

This project is also HEAVILY related to the package aygon/twig-stack. It's kinda like a refactor of their code into Twig 2.*, with my opinionated choices.

CHANGELOG v2.0.0

Version 2.0.0 enables support for both PHP 8.0 and PHP 8.1, while removing support for PHP 7.3 and bellow. If you are still using those old PHP versions, you will need to install the version 1.0.0 of this package.

Installation

You can install this package via composer:

If you are using Symfony, you should be able to configure it by adding a entry into services.yaml:

In either way, you can always add the extension directly into your Twig environment:

Usage

In your base template, define a stack using {% stack %}

Then, in files that either extend your template, or are included by any other, you may use {% push %} and {% prepend %} to add contents to the end and the beginning of the stack, respectively.

To prevent duplicated code, like in files that are included or embed multiple times you can add an "id" to the block declaration in order to the extension to identify the block as unique. Just keep in mind that we will not verify the contents of said block, neither if it is a push or prepend. So watch out for possible collision-naming bugs.


All versions of twig-stack-extension with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
twig/twig Version ^2.10|^3.0
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 filhocodes/twig-stack-extension contains the following files

Loading the files please wait ....