Download the PHP package bnomei/kirby-handlebars without Composer

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

Kirby Handlebars / Mustache

Kirby 5 PHP 8.2 Release Downloads Discord Buymecoffee

Kirby Plugin for semantic templates with Handlebars and Mustache

Installation

Templates

You can can have handlebars and php templates in your /site/templates folder. The plugin will be used as template component for all files with hbs extension and default back to Kirbys core template component for the ones written in php.

Partials

Partials are stored at /site/template/partials. Think of them as reusable blocks injected into your handlebars templates before they get compiled.

/site/templates/partials/piece-of-cake.hbs

/site/templates/call-a-partial.hbs

/content/pizza/call-a-partial.txt

/site/controllers/call-a-partial.php

localhost:80/pizza

Data

For the template to render your content, it needs to know which data to use as variables and list in handlebars. This plugin gives you several ways to provide this data, and you can use them all at once. The data from queries will be merged (recursively) with data from controllers and models.

Built-in Queries

The plugin has a few queries built-in. This allows you to use the queried result directly in your handlebar templates. For example, you can use {{ page.title }} in any handlebar template without having to define that value yourself. You can override these in the bnomei.handlebars.queries option.

Optional parsing of queries in data strings

By default, plain strings from content, controllers, and models are rendered as literal data. This prevents editable content from executing Kirby Query methods before Handlebars renders.

If all rendered content is trusted, you can re-enable the old behavior:

With this option enabled, strings can contain Kirby Query placeholders:

/content/blog/unesco-heritage/post.txt

/site/templates/post.hbs

localhost:80/blog/unesco-heritage

Controllers

/content/home/home.txt

/site/controllers/home.php

/site/templates/default.hbs

Models: Method

/site/models/home.php

Models: Extend model from Plugin and define exported methods

handlebars()/hbs() helper

Maybe you just need to parse some handlebars when you create your data, or you do not use the template component at all. For the later disable the component with the bnomei.handlebars.component config setting and just use the provided helper functions. The hbs()/handlebars() take the same parameters as the Kirby snippet() function. This means they echo the result by default but take a third function parameter to enforce returning the value.

/site/templates/render-unto.hbs

/site/templates/non-hbs-template.php

Render unto Caesar the things that are Caesar's, and unto God the things that are God's.

Render unto Cat the things that are Cat's, and unto Dog the things that are Dog's.

Settings

bnomei.handlebars. Default Description
component true if false no templating will be handled by this plugin and you need to use the hbs()/handlebars() functions.
dir-templates callback returning kirby()->roots()->templates()
dir-partials callback returning kirby()->roots()->templates().'/partials'
extension-input hbs
extension-output php hbs compiled to php
queries [...] an array of predefined queries you can use in your templates
resolve-content-queries false if true, parse Kirby Query placeholders in plain content/controller/model strings

Dependencies

Disclaimer

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.

License

MIT

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.


All versions of kirby-handlebars with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
devtheorem/php-handlebars Version ^1.2
getkirby/composer-installer Version ^1.2
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 bnomei/kirby-handlebars contains the following files

Loading the files please wait ...