2017 © Pedro Peláez
 

library silex-tiny

Silex service provider for Tiny library.

image

jackdaw/silex-tiny

Silex service provider for Tiny library.

  • Wednesday, October 28, 2015
  • by jackdaw
  • Repository
  • 1 Watchers
  • 1 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Silex Tiny Service Provider

A simple Silex Service Provider for Tiny by Zack Kitzmiller., (*1)

Installation

Install via composer, (*2)

$ composer require jackdaw/silex-tiny:dev-master

This will install the package and all the dependencies., (*3)

Before using Tiny, you need to create a random set. You can easily do this using the command line tools included in Tiny., (*4)

$ ./vendor/zackkitzmiller/tiny/bin/genset 

Generating TinyPHP Random Set...
Set Generated
Set: SJYaqGhd6mAe3NbWOB2KwfRtHslMFQkyXCu1gUI4cET97jZPp8nD5iVv0Loxzr 

Now you have random set of characters for Tiny. Time to register the service provider for Silex., (*5)

<?php
use Jackdaw\SilexTiny\TinyServiceProvider;
// Create the Silex Application $app

$app->register(new TinyServiceProvider(), array(
    'tiny.options' => array('set' => 'SJYaqGhd6mAe3NbWOB2KwfRtHslMFQkyXCu1gUI4cET97jZPp8nD5iVv0Loxzr')
));

Passing the random set to the service provider is mandatory., (*6)

Usage

You can use the service like this, (*7)

echo $app['tiny']->to(5);
// E

echo $app['tiny']->from('E');
// 5

echo $app['tiny']->to(126);
// XX

echo $app['tiny']->from('XX');
// 126

echo $app['tiny']->to(999);
// vk

echo $app['tiny']->from('vk');
// 999

Tiny Trait

This package comes with an optional trait for using Tiny., (*8)

// In Application
use \Jackdaw\SilexTiny\TinyTrait;

Now you can simply use Tiny like this, (*9)

echo $app->to(5);
// E

echo $app->from('E');
// 5

Twig Filter

A custom Twig filter is also included in the package. It's just a one way transformation, at least at the moment. This is useful for transforming ids in the view layer of your application., (*10)

// In twig template
{{ 5 | tiny }} // E

The Versions

28/10 2015

dev-master

9999999-dev https://github.com/jackjackdaw/silex-tiny

Silex service provider for Tiny library.

  Sources   Download

MIT

The Requires

 

silex tiny