Download the PHP package twigwp/twig-wordpress without Composer

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

Build Status codecov Scrutinizer Code Quality

Twig for WordPress

Twig for WordPress allow you to use the famous Twig template engine https://twig.symfony.com/ but extend it to be able to use the functions provided by WordPress such as esc_html, esc_html__, wp_kses etc...

This package register the escape function as filters and functions because translator functions need to be pass a textdomain.

Modules

The package provide filters, functions and other stuffs into twig by define modules.

Modules are class instances that implements an interface TwigWp\Module\Injectable used by the Provider TwigWp\Module\Provider that allow us to retrieve all modules to be set into twig instance.

There is a filter twigwp.modules within the Provider::modules method that allow third party softwares to hook into the modules list so, they'll be able to add other filters, functions, tags or whatever they want to use to extend the twig instance (read about how to extend twig here https://twig.symfony.com/doc/2.x/advanced.html).

Escapers

Twig for WordPress define as filters and functions the followings:

Kses

The kses are defined only as functions.

Sanitizers

The sanitizers are defined only as functions.

L10n

Localization functions, including the escaped ones. Localizations functions that start with esc_ (escape) are also registered as filters.

Template Functions

This module include all of the functions that echo html markup even if them are not WordPress template functions.

This because most of the WordPress functions usually get some configuration by array and output html markup. Having to put in a object property the entire markup isn't usefull since you want to have your markup into your views, these functions will help you to pass the configuration and call the output function directly, avoiding to permit to parse html markup that may result in a unescaped html.

Provider

The modules are retrieved by a Provider.

Within the provider the modules can be filtered twigwp.modules.

So if you want to add a new module you can hook into this filter and return a new instance of TwigWp\Module\Injectable.

A Module is used to extend the twig instance, the method injectInto get a \Twig\Environment instance to use for example to add a new function, a new filter or a new tag etc...

For example:

This is just an example because you'll never need to create an instance of the Module Provider. Everything is handled by the Factory class.

You just need to add your filter and everything is ok.

Factory

The package provide a Factory class that help you on creating a new instance of the \Twig\Environment class.

If you want to create a new Twig instance you can simply create a factory instance by passing a \Twig\Loader\LoaderInterface object and the twig options if you want to customize the environment.

Then call the create method and you've done.

Pretty easy, right?

License

This programm is free software and is licensed using GPL2.

For more info about the license see https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html

Requirements

PHP >= 7.0

Bugs Reporting

To report bugs please refer to https://github.com/widoz/twig-wordpress/issues

Support

For support just open a new issue https://github.com/widoz/twig-wordpress/issues and apply the label help wanted.


All versions of twig-wordpress with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
twig/twig Version ^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 twigwp/twig-wordpress contains the following files

Loading the files please wait ....