Download the PHP package brainlight/brainlight-php without Composer

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

Brainlight PHP

Brainlight is a lightweight templating system with minimal logic pattern.

This is a PHP implementation of the Brainlight paradigm.

Requirements

Installation

Require Brainlight Php package in your composer project using the following command:

Usage

Create a new Brainlight Engine instance:

Then render any Brainlight template:

Make reference to the Brainlight documentation for templates syntax.

Additional logic

Brainlight PHP supports templates with additional logic by making use of the class and namespaces.

First consider adding a namespace root in your engine configuration:

Then create a new logic class by extending :

This way, while rendering and class will be loaded.

In addition, the template name inside these tags will be converted to a namespace. So will become .

A Logic class must implement the method:

The purpose of this function is to modify the arguments passed to the template. Such arguments are collected inside the associative array.

It is possible to set mandatory arguments using the array property and mandatory slots using the array property:

It is also possible to change the default template associated with a logic class by setting its property:

To render a template with additional logic directly from a PHP script, use the third parameter of the function:

Options

The Engine constructor supports the following options:

cacheDir

Type: string

Absolute path where cached templates will be stored.

This field is mandatory.

templatesDir

Type: mixed

Absolute path to the directory containing templates. It also accepts an array of paths.

If is provided, the method will accept a fully qualified filename instead of a template name.

Example:

Default value:

partialsDir

Type: mixed

Absolute path to the directory containing partial templates for inclusions and extensions. It also accepts an array of paths.

If is provided, the template engine will consider the template name of inclusion tags as a fully qualified filename instead of a template name.

If is provided, partial templates will be resolved according to the same rule set with .

Default value:

logicNamespace

Type: string|bool

Namespace root used to resolve additional logic classes.

Default value:

extension

Type: string

The Brainlight template file extension.

Default value:

Escaping options

The following options (with default value) are applied to any escape operation performed with the PHP function htmlspecialchars:

License

Brainlight PHP is open-sourced software licensed under the MIT license


All versions of brainlight-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 brainlight/brainlight-php contains the following files

Loading the files please wait ....