Download the PHP package kuz/laratwig without Composer

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

LaraTwig

A simple Twig integration package for Laravel.

Warning

LaraTwig isn't quite ready for public use yet, so do so at your own risk!

Why Twig?

Laravel ships with Blade, which is a decent lightweight template engine. However, sometimes you need something a little more full-featured and powerful, and Twig is the clear leader in PHP template engines. If you're already familiar with Twig, then there's no point in explaining further... you already know the awesomeness. If you're new to Twig, check out the fantastic documentation to see what the fuss is all about.

Why LaraTwig?

There already is a great Twig package for Laravel, and it's a lot more feature-rich than this one. My goal with LaraTwig is to have a simple and straightforward alternative that is easy to maintain and quick to implement.

Installation and Usage

1. Install

Add the package to your composer.json file:

{
    "require": {
        ...
        "kuz/laratwig": "0.*"
    }
}

Then run composer update.

2. Integrate

Register the service provider in app/config/app.php:

'providers' => array(
    ...
    'Kuz\LaraTwig\LaraTwigServiceProvider',
),

3. Configure

If you want to change the default config, run the following Artisan command:

php artisan config:publish kuz/laratwig --path=vendor/kuz/laratwig/config

You can then make changes in app/config/packages/kuz/laratwig/twig.php.

4. Create

Create your view files in the usual place, using the file extension set in the config (.twig by default).

Helper Functions

Twig requires you to register functions that you want to use in your templates. LaraTwig makes this a bit easier by allowing you to specify them in the config file. There are already some commonly-used Laravel functions in there, but you can add your own like this:

'functions' => [
    ...
    'base64_encode',
    'b64e' => function ($value) {
        return base64_encode($value);
    },
],

Basically, we just utilized two different methods to add a base64_encode function for our templates. In the first example, we are telling Twig that calling base64_encode('some string') will call a function of the same name. In the second example, we are telling Twig that calling b64e('my string') will execute the specified closure (or any other callable that you specify).

Facades

LaraTwig does not provide a way to use Facades in your Twig templates. However, Laravel's app() function is already registered for you, which should allow you to pretty much do everything you normally would. For example, if you wanted to use Form::text('name') in your template, you would instead use app('form').text('name').

Acknowledgments

Thanks to Fabien Potencier and the Twig team for building an amazing template engine.

Thanks to Taylor Otwell for creating and maintaining one of the best Web development frameworks available in any programming language.

Thanks to Rob Crowe and Barry vd. Heuvel for their work on the Laravel TwigBridge package, which inspired some of the ideas for LaraTwig.


All versions of laratwig with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/view Version 4.2.*
twig/twig Version 1.*
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 kuz/laratwig contains the following files

Loading the files please wait ....