Download the PHP package wyrihaximus/twig-view without Composer
On this page you can find all versions of the php package wyrihaximus/twig-view. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wyrihaximus/twig-view
More information about wyrihaximus/twig-view
Files in wyrihaximus/twig-view
Informations about the package twig-view
TwigView plugin for CakePHP
This plugin allows you to use the Twig Templating Language for your views.
In addition to enabling the use of most of Twig's features, the plugin is tightly integrated with the CakePHP view renderer giving you full access to helpers, objects and elements.
DEPRECATED: Use cakephp/twig-view instead.
Installation
To install via Composer, use the command below.
Configuration
Load Plugin
Run the following CLI command:
Use View class
Instead of extending from the View
let AppView
extend TwigView
:
Quick Start
TwigView will look for its templates with the extension .twig
.
Layout
Replace templates/layout/default.php
by this templates/layout/default.twig
Template View
Create a template, for example templates/Users/index.twig
like this
Usage
Use $this
With twig $this
is replaced by _view
For example, without using Twig writing
But with Twig
Helpers
Any helper can be access by their CamelCase name, for example:
Elements
Basic
With variables or options
Cells
Store in context then echo it
Fetch and directly echo it
Extends
If i want extend to Common/demo.twig
We can write in a view
Note : the block body
is required, it's equivalent to <?= $this->fetch('content') ?>
Filters
debug
maps todebug
pr
maps topr
low
maps tostrtolower
up
maps tostrtoupper
env
maps toenv
count
maps tocount
pluralize
maps toCake\Utility\Inflector::pluralize
singularize
maps toCake\Utility\Inflector::singularize
camelize
maps toCake\Utility\Inflector::camelize
underscore
maps toCake\Utility\Inflector::underscore
humanize
maps toCake\Utility\Inflector::humanize
tableize
maps toCake\Utility\Inflector::tableize
classify
maps toCake\Utility\Inflector::classify
variable
maps toCake\Utility\Inflector::variable
slug
maps toCake\Utility\Inflector::slug
toReadableSize
maps toCake\I18n\Number::toReadableSize
toPercentage
maps toCake\I18n\Number::toPercentage
number_format
maps toCake\I18n\Number::format
formatDelta
maps toCake\I18n\Number::formatDelta
currency
maps toCake\I18n\Number::currency
substr
maps tosubstr
tokenize
maps toCake\Utility\Text::tokenize
insert
maps toCake\Utility\Text::insert
cleanInsert
maps toCake\Utility\Text::cleanInsert
wrap
maps toCake\Utility\Text::wrap
wrapBlock
maps toCake\Utility\Text::wrapBlock
wordWrap
maps toCake\Utility\Text::wordWrap
highlight
maps toCake\Utility\Text::highlight
tail
maps toCake\Utility\Text::tail
truncate
maps toCake\Utility\Text::truncate
excerpt
maps toCake\Utility\Text::excerpt
toList
maps toCake\Utility\Text::toList
stripLinks
maps toCake\Utility\Text::stripLinks
isMultibyte
maps toCake\Utility\Text::isMultibyte
utf8
maps toCake\Utility\Text::utf8
ascii
maps toCake\Utility\Text::ascii
parseFileSize
maps toCake\Utility\Text::parseFileSize
serialize
maps toserialize
unserialize
maps tounserialize
md5
maps tomd5
base64_encode
maps tobase64_encode
base64_decode
maps tobase64_decode
nl2br
maps tonl2br
string
cast tostring
Functions
in_array
maps toin_array
explode
maps toexplode
array
cast toarray
array_push
maps topush
array_prev
maps toprev
array_next
maps tonext
array_current
maps tocurrent
__
maps to__
__d
maps to__d
__n
maps to__n
__x
maps to__x
__dn
maps to__dn
defaultCurrency
maps toCake\I18n\Number::defaultCurrency
number_formatter
maps toCake\I18n\Number::formatter
uuid
maps toCake\Utility\Text::uuid
time
passed the first and optional second argument intonew \Cake\I18n\Time()
timezones
maps toCake\I18n\Time::listTimezones
elementExists
maps toCake\View\View::elementExists
,getVars
maps toCake\View\View::getVars
get
maps toCake\View\View::get
Twig
Visite Twig Documentaion for more tips
Extra included extensions
Events
This plugin emits several events.
Loaders
The default loader can be replace by listening to the WyriHaximus\TwigView\Event\LoaderEvent::EVENT
, for example with twital:
Extensions
Extensions can be added to the twig environment by listening to the WyriHaximus\TwigView\Event\ConstructEvent::EVENT
, for example:
Bake
You can use Bake to generate your basic CRUD views using the theme
option.
Let's say you have a TasksController
for which you want to generate twig templates.
You can use the following command to generate your index, add, edit and view file formatted
using Twig :
Screenshots
Profiler
Templates found
License
Copyright 2015 Cees-Jan Kiewiet
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
All versions of twig-view with dependencies
ajgl/breakpoint-twig-extension Version ^0.3.0
aptoma/twig-markdown Version ^2.0
asm89/twig-cache-extension Version ^1.0
cakephp/cakephp Version ^3.7
jasny/twig-extensions Version ^1.0
twig/twig Version ^1.27
umpirsky/twig-php-function Version 0.1