2017 © Pedro Peláez
 

library phptransformer

Normalize the API of any PHPTransformer.

image

phptransformers/phptransformer

Normalize the API of any PHPTransformer.

  • Saturday, October 7, 2017
  • by RobLoach
  • Repository
  • 2 Watchers
  • 3 Stars
  • 90 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 1 Forks
  • 21 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

PHPTransformer

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Common interface to manipulate strings/data with any transformer. Great for use in templating libraries, static site generators, web frameworks, and more. Inspired by JSTransformers., (*2)

Supported Transformers

To use each of these transformers, you will also need to composer require them in your project., (*3)

Install

Via Composer, (*4)

``` bash $ composer require phptransformers/phptransformer, (*5)


## Usage ``` php // With "phptransfomers/twig" package $transformer = new PhpTransformers\Twig\TwigTransformer(); echo $transformer->render('Hello, {{ name }}!', array( 'name' => 'World' )); //=> Hello, World!

API

Before all examples, you will need to load a transformer:, (*6)

``` php $transformer = new PhpTransformers\Twig\TwigTransformer(); $transformer = new PhpTransformers\Smarty\SmartyTransformer(); // ... same thing for all other Transformers, (*7)


_See each transformers' repository for more details_ ### `->render($template, $locals)` Renders the given template string, using the provides locals for options passed in. Returns the result as a string. ``` php $locals = array('name' => 'World'); $output = $transformer->render('Hello, {{ name }}!', $locals);

->renderFile($file, $locals)

Renders the given file, using the provided locals for options passed in. Returns the result as a string., (*8)

``` php $locals = array('name' => 'World'); $output = $transformer->renderFile('hello.twig', $locals);, (*9)


## Testing ``` bash $ composer test

Contributing

Please see CONTRIBUTING for details., (*10)

Credits

License

The MIT License (MIT). Please see License File for more information., (*11)

The Versions

15/05 2016

dev-composer-no-update

dev-composer-no-update https://github.com/phptransformers/phptransformer

Normalize the API of any PHPTransformer.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

phptransformer

25/02 2016

1.0.0

1.0.0.0 https://github.com/phptransformers/phptransformer

Normalize the API of any PHPTransformer.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

phptransformer

24/04 2015

0.0.1

0.0.1.0 https://github.com/phptransformers/phptransformer

Normalize the API of any PHPTransformer.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

phptransformer