Download the PHP package contentasaurus/lightncandy without Composer

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

LightnCandy

⚡🍭 An extremely fast PHP implementation of handlebars ( http://handlebarsjs.com/ ) and mustache ( http://mustache.github.io/ ).

Travis CI status: Unit testing Regression testing

Scrutinizer CI status: Code Coverage

Package on packagist: Latest Stable Version License Total Downloads HHVM Status

Features

Installation

Use Composer ( https://getcomposer.org/ ) to install LightnCandy:

UPGRADE NOTICE

Documents

Compile Options

You can apply more options by running LightnCandy::compile($template, $options):

Default is to compile the template as PHP, which can be run as fast as possible (flags = FLAG_BESTPERFORMANCE).

Error Handling

JavaScript Compatibility

Mustache Compatibility

Handlebars Compatibility

Handlebars Options

PHP

Partial Support

Custom Helper

Custom Helper Examples

#mywith (context change)

#myeach (context change)

#myif (no context change)

You can use isset($options['fn']) to detect your custom helper is a block or not; you can also use isset($options['inverse']) to detect the existence of {{else}}.

Data variables and context

You can get special data variables from $options['data']. Using $options['_this'] to receive current context.

Private variables

You can inject private variables into inner block when you execute child block with second parameter. The example code showed similar behavior with {{#each}} which sets index for child block and can be accessed with {{@index}}.

Change Delimiters

You may change delimiters from {{ and }} to other strings. In the template, you can use {{=<% %>=}} to change delimiters to <% and %> , but the change will not affect included partials.

If you want to change default delimiters for a template and all included partials, you may compile() it with delimiters option:

Template Debugging

When template error happened, LightnCandy::compile() will return false. You may compile with FLAG_ERROR_LOG to see more error message, or compile with FLAG_ERROR_EXCEPTION to catch the exception.

You may generate debug version of templates with FLAG_RENDER_DEBUG when compile() . The debug template contained more debug information and slower (TBD: performance result) , you may pass extra LightnCandy\Runtime options into render function to know more rendering error (missing data). For example:

The ANSI output will be:

Here are the list of LightnCandy\Runtime debug options for render function:

Preprocess Partials

If you want to do extra process before the partial be compiled, you may use prepartial when compile(). For example, this sample adds HTML comments to identify the partial by the name:

You may also extend LightnCandy\Partial by override the prePartial() static method to turn your preprocess into a built-in feature.

Customize Render Function

If you want to do extra tasks inside render function or add more comment, you may use renderex when compile() . For example, this sample embed the compile time comment into the template:

Your render function will be:

Please make sure the passed in renderex is valid PHP, LightnCandy will not check it.

Customize Rendering Runtime Class

If you want to extend LightnCandy\Runtime class and replace the default runtime library, you may use runtime when compile() . For example, this sample will generate render function based on your extended MyRunTime:

Please make sure MyRunTime exists when compile() or rendering based on your FLAG_STANDALONEPHP .

Unsupported Feature

Suggested Handlebars Template Practices

Detail Feature list

Go http://handlebarsjs.com/ to see more feature description about handlebars.js. All features align with it.

Framework Integration

Tools


All versions of lightncandy with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.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 contentasaurus/lightncandy contains the following files

Loading the files please wait ....