Download the PHP package icybee/patron without Composer

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

Patron

Release Build Status HHVM Code Quality Code Coverage Packagist

Patron is a template engine for PHP5.4+. It facilitates the separation of the application logic and content from its presentation. Templates are written in HTML and include expressions that are replaced as the template is parsed, and special markups that control the logic of the template.

A typical example

Features

Acknowledgment

This template engine was developed because around 2007 textpattern didn't support nested markups, and I though it would be a good exercise. Some part of its code have slept for a long time, so don't be surprise if you see some camel casing although snake casing is used nearly everywhere, at least you'll recognize the old parts :-)

Expressions

Expressions, using the #{<expression>} notation, are used to output data. The data is always escaped unless the = modifier is used, just before the closing }. The @ sign is used to access the properties of the subject (although you can also use this).

Markup collection

The markups that can be used by a Patron engine instance are defined in a MarkupCollection instance, which is used to create the Engine instance. The get_markups() helper function can be used to obtain a shared markup collection. When it is first created, the MarkupCollection::alter event of class MarkupCollection\AlterEvent is fired. Event hooks may use this event to alter the collection, adding and removing markups definitions.

The following example demonstrates how an event hook may be used to add a hello markup, that supports a name argument which defaults to "world":

The following markups are defined.

The p:if markup

Provides a simple if-then conditionality.

Either test or select and an operator (e.g. equals) should be defined. The test is silent, and should not generate notices.

The p:choose markup

Selects one among a number of possible alternatives.

It consists of a sequence of p:when elements followed by an optional p:otherwise element. Each p:when element has a single attribute, test, which specifies an expression. The content of the p:when and p:otherwise elements is a template. When an p:choose element is processed, each of the p:when elements is tested in turn, by evaluating the expression and converting the resulting object to a boolean as if by a call to the boolean function. The content of the first, and only the first, p:when element whose test is true is instantiated. If no p:when is true, the content of the p:otherwise element is instantiated. If no p:when element is true, and no p:otherwise element is present, nothing is created.

The p:foreach markup

Applies a template to each entries of the provided array.

At each turn the following variables are updated in self:

The p:variable markup

Binds a name to a value.

The value to which a variable is bound (the value of the variable) can be an object of any of the types that can be returned by expressions. There are two elements that can be used to bind variables: p:variable and p:with-param. The difference is that the value specified on the p:with-param variable is only a default value for the binding; when the template within which the p:with-param element occurs is invoked, parameters may be passed that are used in place of the default values.

Both p:variable and p:with-param have a required name attribute, which specifies the name of the variable. The value of the name attribute is a qualified name.

The p:with markup

Parses a template with a bounded value.

The p:decorate markup

Decorates a content with a template.

The content of the markup is rendered to create the component to decorate, it is then passed to the decorating template as the component variable.

The name of the decorating template is specified with the with attribute, and is interpolated e.g. if "page" is specified the templates "@page.html" or "partials/@page.html" are used, which ever comes first.

The parameters specified using with-param, as well as the attribute of the markup (except with) are made available as variables in the decorating template.

The @page.html template:

The p:template markup

Adds a template.

The name attribute defines the name of the template. The content of the markup defines the template.

The p:call-template markup

Calls a template.

The p:translate markup

Translates and interpolates a string.

The arguments for the interpolation are provided using the attributes of the markup, or the with-param construction.

Example:

The p:document:css markup

CSS assets can be collected and rendered into LINK elements with the p:document:css element. The href attribute is used to add an asset to the collection. The weight attribute specifies the weight of that asset. If the weight attribute is not specified, the weight of the asset is defaulted to 100. If the href attribute is not specified, the assets are rendered. If a template is specified the collection is passed as this, otherwise the collection is rendered into an HTML string of LINK elements.

Note: This markup requires the brickrouge/brickrouge package.

Example:

will produce:

The p:document:js markup

JavaScript assets can be collected and rendered into SCRIPT elements with the p:document:js element. The href attribute is used to add an asset to the collection. The weight attribute specifies the weight of that asset. If the weight attribute is not specified, the weight of the asset is defaulted to 100. If the href attribute is not specified, the assets are rendered. If a template is specified the collection is passed as this, otherwise the collection is rendered into an HTML string of SCRIPT elements.

Note: This markup requires the brickrouge/brickrouge package.

Example:

will produce:

The p:pager markup

Renders a page element.

Note: This markup requires the brickrouge/brickrouge package.

Function collection

The functions that can be used by a Patron engine instance are defined in a Engine instance. The get_functions() helper function can be used to obtain a shared markup collection. When it is first created, the FunctionCollection::alter event of class FunctionCollection\AlterEvent is fired. Event hooks may use this event to alter the collection, adding and removing functions.

The following example demonstrates how an event hook may be used to add a hello function:

The following functions are defined by default:

Finding a function

The find() method is used to find a function in the collection, it may also check functions that are defined outside of the collection, such as PHP functions.

Executing a function

You can used the find() method to find a function than use the returned value to call the function, or you can directly call the function like it is a method of FunctionCollection.

The FunctionNotDefined exception is thrown if the function called is not defined.

Event hooks


Requirements

The package requires PHP 5.4 or later.

Installation

The recommended way to install this package is through Composer:

The following packages are required, you might want to check them out:

Cloning the repository

The package is available on GitHub, its repository can be cloned with the following command line:

$ git clone https://github.com/Icybee/Patron.git

Documentation

The package is documented as part of the [ICanBoogie][] framework documentation. You can generate the documentation for the package and its dependencies with the make doc command. The documentation is generated in the build/docs directory. ApiGen is required. The directory can later be cleaned with the make clean command.

Testing

The test suite is ran with the make test command. PHPUnit and Composer need to be globally available to run the suite. The command installs dependencies as required. The make test-coverage command runs test suite and also creates an HTML coverage report in "build/coverage". The directory can later be cleaned with the make clean command.

The package is continuously tested by Travis CI.

Build Status Code Coverage

License

This package is licensed under the New BSD License - See the LICENSE file for details.


All versions of patron with dependencies

PHP Build Version
Package Version
Requires php Version ^5.5|^7.0
icanboogie/common Version ^1.2
icanboogie/render Version ^0.5
icybee/bluetihi Version ^0.0.3
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 icybee/patron contains the following files

Loading the files please wait ....