Download the PHP package grithin/phptemplate without Composer

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

About

A customizable, simple templating system, using vanilla PHP.

Features

A Note On PHP-HTML Integration

Spaghetti code is bad, but integrating PHP code with HTML does not have to result in spaghetti code.

If you follow a sane set of rules, and you do not mix control code with view code, you will be fine.

The reasons people present for using templating systems with custom syntax are often invalid:

The one reason that remains, after discarding avoidance of spaghetti code, is security. Some template engines allow you to prevent execution of arbitrary PHP code, which allows you to reduce the damage designers might do when using code.
Although security can be done even when the template is written with native PHP code, (get_all_tokens), I have had no need for such security so I have not extended this tool to do that, and if you need such security, you should go with another templating engine that has this feature (twig) or convince me to spend the time extending this tool.

Why?

Probably mainly because of a bad experience in 2006 when I had to rewrite various parts of the smarty templating engine to fix caching problems the company was having. But, apart from that:

Guide

Plain Use

Template files are expected to end in .php

You can include another template from within a template

You can even do so relative to the path of the current template

This might be useful if a site section had its own sidemenu.

The $Template variable is injected into the context of the template file. It can be referenced three ways, $t, $template, and $Template, but only $Template is guaranteed not to be overwritten.

These keys are part of the helper array that are provided to templates. The helper array is a list of variables that are imported into the scope of the template. They can be values, closures, or anything that can fit inside a variable.

The instance level helpers, like t, may be overwitten by variables of the same key provided to the get call.

To avoid using a variable that might not exist, the variables passed to get are available as keys in $vars.

$vars represents the variables passed in through get. $vars can be overwritten by a passed variable. If $vars is overwritten, it can still be accessed with $Template->vars

You can also access class instance helpers that were overwritten

To get the string identity of the current template, use <?= $Template->template ?>

Sections And Hierarchy

A template can have a parent/layout

A parent refers to the content of the child with $Template->inner

Templates can also use sections

Parents, or other templates, can use these defined sections

You can append an existing section

You can directly set the section variable if desired

Parent Complexities

The parent template gets the vars passed to the child template. Though, the child template can also pass variables to the parent, and these will overwrite, based on keys, the child variables within the tempalte


All versions of phptemplate with dependencies

PHP Build Version
Package Version
Requires php Version >=7
grithin/phpbase Version >=5
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 grithin/phptemplate contains the following files

Loading the files please wait ....