Download the PHP package barryvdh/laravel-twigbridge without Composer

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

Laravel 4 TwigBridge

Note: This package is deprecated in favor of https://github.com/rcrowe/TwigBridge. Please try the 0.6.x release, which should be very similar and provide the same functionality. Further progress will take place there.

This packages adds Twig as a Laravel Template Engine:

See http://twig.sensiolabs.org/ for more info about Twig Templating

Install

Require this package in your composer.json and run composer update (or run composer require barryvdh/laravel-twigbridge:dev-master directly):

"barryvdh/laravel-twigbridge": "0.3.x"

After updating composer, add the ServiceProvider to the providers array in app/config/app.php

You can add the Twig Facade to have easy access to Twig_Environment, ie. Twig::render('template.twig').

Usage

After install, you can just use View::make('index'); The .twig extension should be omitted in the View::make() call, just like Blade files. Within your Twig files, you can reference them with or without .twig. You can also use view composers/creators, just like in Blade templates.

Extensions

The following helpers/filters are added by the default Extensions. They are based on the helpers and/or facades, so should be self explaining.

Functions:

Filters:

Global variables:

Example Template Syntax

In a Blade template, if you had a route to edit a task in a Task/Todo application, you would use the following syntax to link to a route.

{{ link_to_route('tasks.edit', 'Edit', $task->id, array('class' => 'btn btn-primary')) }}

In a Twig template you would do the same thing using the following syntax. Notice the task object drops the dollar sign ($) and instead of an arrow (->) you use a period ('.'). Also, you convert the array to a Python/Javascript dictionary type syntax.

{{ link_to_route('tasks.edit', 'Edit', task.id, {'class': 'btn btn-primary'}) }}

Commands

2 Artisan commands are included:

Configure

To publish a configuration file, you can run the following command:

Change your config to choose what helpers/filters you want to use, and what Facades to register. You can also pass in a callback or array to define options. You can also use an instance of Twig_SimpleFunction or Twig_SimpleFilter. Besides facades, you can also add your Models.

Extend

The Twig_Environment is available as 'twig' in the App Container, so you can access it via app('twig') or App::make('twig'). The ChainLoader is 'twig.loader', the array templates are in 'twig.templates'. You can also use the Twig Facade to access the Twig_Environment functions directly.


All versions of laravel-twigbridge with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
illuminate/support Version 4.x
illuminate/view Version 4.x
twig/twig Version ~1.12
symfony/twig-bridge Version >=2.3
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 barryvdh/laravel-twigbridge contains the following files

Loading the files please wait ....