Download the PHP package parisek/twig-attribute without Composer

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

parisek/twig-attribute

A Twig 3 extension that gives templates a create_attribute() function for collecting, sanitizing, and rendering HTML attributes — backed by a vendored, maintained port of Drupal's Attribute class.

The package ships its own port (under Drupal\Component\Attribute) rather than depending on Drupal core. The vendored sources are refreshed from Drupal 11.x on each release; the API matches what Drupal templates expect.

Installation

Requires PHP ^8.3 and Twig ^3.0. No Drupal dependencies.

Usage

Plain PHP:

Symfony service:

In templates

The full API (class methods, escape semantics, without filter behavior) mirrors Drupal's Attribute class.

Upgrading from 1.5.x to 1.6.0

Action required: none for the vast majority of consumers. Run composer update parisek/twig-attribute.

What changes under the hood:

Edge cases that may need action

Direct PHP usage

If your code does new \Drupal\Component\Attribute\AttributeCollection(...) in PHP (instead of using create_attribute() from Twig), the refresh adds methods but doesn't remove any. Your existing calls keep working in 1.6.0.

Development

Source-of-truth for the vendored Drupal port is Drupal 11.x core at git.drupalcode.org/project/drupal/-/tree/11.x/core/lib/Drupal/Core/Template. When the upstream changes meaningfully, copy the relevant files into .upstream/ (gitignored scratch dir) and re-port. See docs/refresh-decisions.md for the rationale behind the inline shims that let this package drop drupal/core-render and drupal/core-utility.

Use cases


All versions of twig-attribute with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
twig/twig Version ^3.27
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 parisek/twig-attribute contains the following files

Loading the files please wait ...