Download the PHP package nystudio107/twig-bundle-installer without Composer

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

Scrutinizer Code Quality Build Status Code Intelligence Status

Twig Bundle Installer plugin for Composer

A Composer plugin that installs & manages Twig Bundles in your templates/vendor/ directory

Overview

Twig Bundle Installer is a Composer installer that installs and manages Twig Bundles in your templates/ directory. It introduces the concept of Twig bundles and installs them in templates/vendor/, similarly to how you’d normally install PHP packages in vendor/. (And it doesn’t change anything about that; your PHP bundles will still live in vendor.)

It implements a new Composer package type named twig-bundle, which should be used when publishing Twig Bundles. Composer manages it all, and Twig Bundle Installer is not tied to any particular CMS or system. Anything that uses Twig might find it useful.

This allows you to install and update Twig templates across multiple projects in a managed way.

Why Though?

Why Twig Bundle Installer?

I'd originally thought of the idea implemented in Twig Bundle Installer when working on re-usable Twig components.

Later the idea came up again when I worked on a base Twig templating layer as discussed in the An Effective Base Twig Templating Setup article.

Then it idea came up again when discussing with a colleague how they managed multiple brand properties in a large Craft CMS install via separate plugins. Each brand site had its own custom plugin which was mostly a wrapper for the templates needed for said site.

So if something comes up 3x or more, I think it's probably worth trying out…

Using Twig Bundle Installer

Consuming Twig Bundles

Adding Twig Bundles to your Project

To use Twig Bundles in your own project, first you need to add Twig Bundle Installer to your project's composer.json:

Because Twig Bundle Installer is a Composer plugin, you will also need to tell Composer that's it okay to use this plugin via config:allow-plugins in your composer.json file:

Then you can add in the vendor/package name of the Twig Bundle you want to use just like you would any Composer package:

Then just do a:

What Twig Bundle Installer does is for Composer packages that are of the type twig-bundle instead of putting them in the vendor/ directory, it will put them in the templates/vendor/ directory.

In the above example, you'll end up with something like this:

This means that you can install & update these Twig Bundles across multiple projects. They can be Twig Bundles you've created, or Twig Bundles others have created.

It works just like any Composer package does, because Twig Bundle Installer is just a layer on top of Composer that routes packages of the type twig-bundle to a different directory.

Commands you're used to such as composer require, composer update, etc. all work as you'd expect.

Example including a template from a Twig Bundle:

Twig Bundle Considerations

Since Twig Bundle Installer is looking for a directory in your project root named templates/ that points to your Twig templates directory:

Example .gitignore file:

Local Repositories

If you want to use local Twig Bundles while you work on them, you can do that via the Composer Repositories setting:

Where the url setting is a path to where your source Twig Bundles live.

Creating Twig Bundles

To create a Twig Bundle, create a directory with a Composer.json file in it that looks like this:

...but obviously change the name to your vendor/bundle name, and fill in your own description, etc. The key is that you must have the type set to twig-bundle:

You'll then want to publish this to a GitHub or other Git repo, publish it on Packagist.org so others can install it via Composer

If you've never published a package on Packagist before, just follow the instructions on Packagist.org or read the Packagist and the PHP ecosystem article.

You can use the Test Twig Bundle as an example to follow.

Twig Bundle Installer Roadmap

This project is usable as-is, but it's also very much in the germination phase. I'm curious to see what uses people find for it, or potentially none at all.

Some ideas:

Brought to you by nystudio107


All versions of twig-bundle-installer with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
composer-plugin-api Version ^1.0 || ^2.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 nystudio107/twig-bundle-installer contains the following files

Loading the files please wait ....