Download the PHP package anax/view without Composer

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

Anax View

Latest Stable Version Join the chat at https://gitter.im/mosbth/anax

Build Status CircleCI

Build Status Scrutinizer Code Quality Code Coverage

Maintainability Codacy Badge

Anax View module to supply a structure of views to a Anax website.

About views, terminology and structure

The views, also known as template files, are pure PHP files and their purpose is to render content onto a html structure to create a web page.

It works like this:

  1. The content of the webpage is gathered as a collection of views.
  2. The view collection is created in the router callbacks and controllers.
  3. A view is a combination of variables (content), commonly known as $data, which is supplied to a template file, which is executed and renders the data onto a html structure.
  4. Each view is a small part of html and content and rendered onto the web page.

You can see a sample of views in the directory view/anax/v2.

Views are rendered in a layout

The views are rendered in an orderd fashion by a structured layout. This layout is in itself a view (template file and data), it is just a view which renders more views.

You can see a sample of an layout view in view/anax/v2/layout.

The layout views you above have organised each part of the web page as regions. Each view is rendered in a region.

This code shows how a general region is setup in the layout file, and how it renders the views belonging to this region.

You can optionally add a region, and a sort value, when you add the views to the collection. This is what decides where (region), and in what order the view is rendered.

A template file for the view

A template file is an ordinary PHP-file. Here is the template file anax/v2/article/default.

The namespace makes it possible to access a list of built in view helper functions, for example helper functions to escape output or create urls into the framework or assets.

The commented section can be uncommented for debugging what helper functions and what variables that are available.

The general idea is then to further prepare content through incoming variables.

Then finally render the output.

That is the general procedures of a template file.

View helpers

The file View/ViewHelperFunctions holds the helper functions that eases work in the template files.

Here are some essential helpers.

Function Details
asset($url) Create a link to a static asset (css, img, php-file, pdf).
e($str) A shortcut for `htmlentities().
url($url) Create an url within the framework, for example "" (home route) or "doc/about".
redirect($url) Redirect to another url (within the framework), for example "game/init".

Review the helper files for details.

Dumb views or fat views

A view can be "dumb" and only recive input from the framework, and render it with the html code.

A view can also be "fat", or perhaps not so "smart", and make calls back into the framework.

The general recomendation is to have dumb views and not make calls back into the framwork.

Type of views

A view can generally render any type of result and is not limited to html only.

License

This software carries a MIT license. See LICENSE.txt for details.


All versions of view with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
anax/commons Version ^2.0.0@alpha
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 anax/view contains the following files

Loading the files please wait ....