2017 © Pedro Peláez
 

library minii

Minii, a simple template engine for PHP!

image

minii-php/minii

Minii, a simple template engine for PHP!

  • Wednesday, January 31, 2018
  • by victor_8d
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Minii Template

Minii, is a simple template engine for PHP!, (*1)

Install

You can install it using Composer., (*2)

composer require minii-php/minii

Config

First you need create the config., (*3)

$config = [

    'views' => 'app/views',
    'includes' => 'app/views/components',
    'globals' => [
        'root' => 'http://localhost:8000/'
    ]
];
  • views : Is the location of the views.
  • includes : Is the location of the includes.
  • globals : Is the global variables.

Use

// $... = new Minii\View( [ Config ] );
$minii = new Minii\View($config);

// $...->render( View , [ Variables ] );
echo $minii->render('home',['name'=>'Minii']);

Render

The Minii use HTML files:, (*4)

Load Includes

You may load includes out of the view., (*5)

app/views/components/header.html, (*6)

// $...->load( Include , [ Variables ] );
$header = $minii->load('header',['name'=>'Minii']);

Delimiters

  • {{ $... }} : Use to print a variable.
  • {% ... %} : Use to include a component.

app/views/home.html, (*7)

{% header %}

<a href="{{ $root }}">
    <h1>{{ $name }}</h1>
</a>

{% footer %}

You can use the variables in includes:, (*8)

app/views/components/header.html, (*9)

// header include

<header>
    <a href="{{ $root }}">
        <span>{{ $name }}</span>
    </a>
<header>

Control Structures

If Statements, (*10)

You may construct if statements using the @if, @elif, @else, and @endif directives., (*11)

@if( $num == 1 )

    $num is equal to 1

@elif( $num > 1)

    $num is greater than 1

@else

    $num is less than 1

@endif

Loops, (*12)

@for ($i = 0; $i < 10; $i++)

    The current value is {{ $i }}

@endfor

The Versions

31/01 2018

dev-master

9999999-dev

Minii, a simple template engine for PHP!

  Sources   Download

MIT

The Requires

  • php >=7.0

 

by Victor M.

25/01 2018

1.0.0

1.0.0.0

Minii, a simple template engine for PHP!

  Sources   Download

MIT

The Requires

  • php >=7.0

 

by Victor M.