Download the PHP package mkgor/puff without Composer

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

Coverage GitHub repo size Packagist GitHub All Releases

Puff

Logo

Hackable and lightning fast template engine for PHP, which is inspired by Twig.

Contents

Requirments

Installation

Install Puff via composer

`

Quickstart

``

`

Important! Don't forget to initialze CoreModule here if you need all basic statements, such as for, if-else, etc.
Also important! Puff automatically converts '-' and '.' symbols into '_' in variable's name.

Specification

Instructions for executing basic statements, such as if-else, for, import, etc. indicated by combination of characters `

To display variable's value, you should use `

For

Working like PHP's foreach cycle

`

If-else

Simple if-else implementation

`

Import

You can import template into another using import

If you are not specified templates directory path, you should set template path relative to project root

Important! Don't forget, that you are injecting all variables from current template into importing template. If template which you are importing using some variable (for example - it is displaying page title in header), you should specify it in render method `

Set

Creates/Updates variable

`

Extends and Position

Use this tags to define the parent template and load data from the current template into it using the Position tag.

Usage:

Main template `

Parent template `

Filters system

You can modify some variables before displaying them or if some statement supports filters, you can modify variable before using it in it.

To specify filters for variable, you should specify them by ~ sign.

Example:

`

`

You also can use filters in for statement

`

You can create your own filters. Read how to do it in Extensions system block

Extensions system

Puff is extensible, so you can create your own modules, which can contain your own statements and filters.

To create module, just create class which implements Puff\Modules\ModuleInterface and insert in into modules array of Engine configuration

``

Important! Don't forget to initialze CoreModule here if you need all basic statements, such as for, if-else, etc.

Making new statement (element)

To make new element, you should create class, which should extend Puff\Compilation\Element\AbstractElement

You should specify element's class in your Module class's setUp() method:

``

Now, your element is accessible in template by test_element keyword

Element's process method should return PHP code.

``

You can provide some attributes handling rules. By default, it is handling like this: `

But if you want to make statement like for (which don't use attributes like "attribute='attr'") you can provide your own attributes handling rules by specifying handleAttributes method in your element class

It is getting an array of all elements from tokenizer and should return an array

For example:

`

``

`

Making new filter

To make new element, you should create class, which should extend Puff\Compilation\Element\AbstractElement

You should specify element's class name in Module's class setUp() method:

``

Your filter class should implement Puff\Compilation\Filter\FilterInterface

For example, discover UpperCaseFilter code to understand how it works

``

Value, which handle method returns, will be assigned to variable

Syntax editing

You can configure some elements of syntax, such as symbols which are Puff using in tags, equality symbol, filter separator symbol and etc.

To do this, you should create new class, which can implements Puff\Tokenization\Syntax\SyntaxInterface or extends Puff\Tokenization\Syntax\AbstractSyntax. Let's see how it works with AbstractSyntax

``

So, we are specified new element tag's symbols. To make it work, you should set it in the configuration array in Engine constructor, or set it in Module's setUp() method.

``

Now, all tags should use new syntax, let's see how we should update template

`

Escaping tags

To escape tag, you should set escaping symbols before some tag to tell compiler to ignore it.

Default escaping symbols in Puff is //, but you can edit it by setting your own Syntax class

`

Will display: `


All versions of puff with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
ext-mbstring Version *
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 mkgor/puff contains the following files

Loading the files please wait ....