Download the PHP package peak/view without Composer

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

Peak Peak/View

version License

Fast and minimalist view template engine with macro, helpers and directives.

! Deprecated

This package is mark as deprecated! It may receive bug fixes if needed but that's it. I strongly encourage users to switch to a modern JS front framework instead of using PHP as templating engine.

Installation

This is a standalone package and not provided automatically with peak/framework

Basic usage

A view need at least 2 things:

Example of view templates

layout example:

script example (represented by in your layout):

Render a view

Create a complex Presentation

Macros

Macro are closure that will be bind to your view class instance. They have access to all class properties/methods so they must be used carefully. Macro are ideal for small task.

and in your template view:

Helpers

An helper is a standalone object instance that is callable. In contrary of macro, helper do not have access to view properties/methods directly but tend to be more maintainable and secure than macro. Helper are ideal for advanced task and can benefit from dependencies injection.

Example of an helper class:

Before you can use it, you'll need to give a function name to your view helper:

and finally, you'll be able to use your helper the same way you use macros

Directives

Directives provide you a simpler and more elegant syntax for writing templates. By default, there is no directive activated in your View. You need to add them to your View instance with setDirectives() method. The downside of directives is that View must run them after rendering a template, adding an extra compilation step. The more directives you have, the more it take times to render the view . Of course, this side effect can be mitigated with a proper caching solution, but to keep things simple, Peak View doesn't provide one by default.

template.php

It is important to keep in mind that PHP is executed first in your template and directives are compiled/rendered after that.

You can also write you own directive by using .


All versions of view with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
peak/blueprint Version ^4.0
psr/container Version ^1.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 peak/view contains the following files

Loading the files please wait ....