<commit_before>Plates Template Engine for Silex
================================

This project aims to provide integration of the [Plates](http://platesphp.com/)
template engine into the [Silex micro-framework](http://silex.sensiolabs.org/).

This project is in the very early stages, so don't be surprised if the
integration is less than optimal.

This project is based very heavily on the default TwigServiceProvider and
the Symfony-Twig bridge Twig extensions.

Usage
-----

```php
<?php

/* @var $app Silex\Application */
$app->register(new \Rych\Silex\Provider\PlatesServiceProvider(), array (
    'plates.path' => '/path/to/templates', // Required
    'plates.folders' => array (            // Optional
        'email' => '/path/to/email/templates';
    ),
));

$app->get('/', function () use ($app) {
    return $app['plates']->render('mytemplate');
});

```

Extensions
----------

This provider also registers common extensions which work very similar to
those found in the Symfony-Twig bridge. I hope to add more in the future, but
right now I've only included the big ones I use regularly.

### Routing Extension ###

Provides the `url` and `path` functions for generating URIs. This extension is
only available if the url_generator service is available.

### Security Extension ###

Provides the `is_granted` function. This extension is only available if the
security service is available.

Custom Extensions
-----------------

You may choose to register your own Plates extensions. This can be accomplished
easily by extending the plates.engine service.

```php
<?php<commit_msg>Clean up the README.<commit_after>Plates Template Engine for Silex
================================

This project aims to provide integration of the [Plates](http://platesphp.com/)
template engine into the [Silex micro-framework](http://silex.sensiolabs.org/).
It's in the very early stages, so don't be surprised if the integration is less
than optimal.

The project is based very heavily on the default `TwigServiceProvider` and
some of the Symfony-Twig bridge extensions.

Usage
-----

Add the provider to your `composer.json` file:

```json
{
    "require": {
        "rych/silex-plates-provider": "dev-master@dev"
    }
}
```

Enable it in your application:

```php
<?php

/* @var $app Silex\Application */
$app->register(new \Rych\Silex\Provider\PlatesServiceProvider(), array (
    'plates.path' => '/path/to/templates', // Required
    'plates.folders' => array (            // Optional
        'email' => '/path/to/email/templates';
    ),
));

$app->get('/', function () use ($app) {
    return $app['plates']->render('mytemplate');
});

```

Extensions
----------

This provider also registers common extensions which work very similar to
those found in the Symfony-Twig bridge. I hope to add more in the future, but
right now I've only included the big ones I use regularly.

### Routing Extension ###

Provides the `url` and `path` functions for generating URIs. This extension is
only available if `UrlGeneratorServiceProvider` is registered.

### Security Extension ###

Provides the `is_granted` function. This extension is only available if
`SecurityServiceProvider` is registered.

Custom Extensions
-----------------

You may choose to register your own Plates extensions. This can be accomplished
easily by extending the `plates.engine` service.

```php
<?php
{'fraction_non_alphanumeric': 0.14239098190447938, 'fraction_numerical': 0.0, 'mean_word_length': 3.76271186440678, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1283323', 'n_tokens_mistral': 949, 'n_tokens_neox': 920, 'n_words': 369}