Download the PHP package lorenzosanzari/mozaiku without Composer

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

Mozaiku

Plain PHP Template Inheritance

Inspired by several hierarchical template engines like Twig or Blade, Mozaiku offers to you the possibility of building hierarchical templates using simply plain PHP language. It is a very simple and lightweight class, with very small footprint.

License

Mozaiku is released under the MIT license.

Install via Composer

If you are using Composer, you can run the following command:

OR you can download the zip file directly from Github and extract them to your web directory.

Template inheritance

What is template inheritance? Template inheritance is an elegant way to make and compose reusable HTML layouts in a web application. It is much more powerful than traditional "include" (bad) practice (like include a header and footer file).

With Mozaiku, you can implement template inheritance simply using plain PHP language. There is no need to learn another template language.

Having a main template, you can conceptually define a "child" view that extends the main layout. This means that it will have the same general appearance as the layout, but will redefine some sections with its own content. In other words, in the child view, you only need to redefine the sections you want to change with respect to the theme (section override) and the whole page will inherit all the rest of the content from the "parent" theme.

Sections

In a layout, you can define a new section simply by writing:

The sections can also be nested, to allow a more detailed management of the contents to be overwritten. In the same layout it is not possible to define multiple sections with the same name.

Parent section content

In a section it is possible to insert a new content, but also to recall the content of the same section of the parent layout, through the directive:

Extending a parent layout

Example:

Warning: the $this->extendsView('my_parent_view.php') directive MUST be placed at start of the child page!

Rendering 'page.php' with Mozaiku, you will obtain the following output:

If in your template you simply want to show the contents of a section populated by child views, you can simply write:

Include partial view in your layout

You can include some partial view in a section of your layout (or in any point, if your view is not a child view), simply by writing:

Rendering or Capturing Output

The render() function

allows you both to show the final output, and to capture its contents in a variable (string). If third parameter (e.g $return) is equal true, $output will contain all the output from the processed view.

Content Stacks

Mozaiku allows you to push contents to named stacks which can be rendered at some point in your layout. This is very useful to inject JavaScript or CSS tags or script required by your child views:

Render the stack: In your html layout:

Debug and strict mode

You can use Mozaiku in debug mode to display debugging information related to the status of the internal stacks of section overrides:

The strict mode will give you error messages about the optimal way to write contents within the views:

For any further doubts, see the example files included in the project. ;-)


All versions of mozaiku with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.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 lorenzosanzari/mozaiku contains the following files

Loading the files please wait ....