2017 © Pedro Peláez
 

library chert

It is a simple routing library using annotations and caching.

image

n0wada/chert

It is a simple routing library using annotations and caching.

  • Monday, April 10, 2017
  • by n0wada
  • Repository
  • 0 Watchers
  • 0 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Chert

It's an alternative to ControllerProvider for Silex application, using annotations and caching. Chert is inspired by Orlex, (*1)

Install

Chert uses Composer to install:, (*2)

  "require": {
      "n0wada/chert": "dev-master"
  }

Parameters

chert.cache_dir

The cache directory. This library save RouteCollection Object there.
If you use FilesystemCache(default), This Parameter is required., (*3)

chert.cache_lifetime

The lifetime in number of seconds for this cache entry. default lifetime is 0., (*4)

chert.controller_dirs

It is an array of pairs of namespace and directory., (*5)

chert.cache

If you want to use ApcCache, MemCached, Redis etc., you can set Cache Object here.
You need to implements Doctrine\Common\Cache\Cache Interface., (*6)

Usage

Resister Provider in your Silex application., (*7)

$app = new \Silex\Application();

$app->register(new \Chert\RouteCompileServiceProvider(),[
    'chert.cache_dir' => __DIR__ . '/cache,
    'chert.controller_dirs' => ['Controller' => __DIR__ . '/controllers]
]);

$app->run();

Set up Routing in your Controller., (*8)

namespace Test\Controller;

use Chert\Annotation\Route;
use Chert\Annotation\Value;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
 * @Route(path="/test")
 */
class TestController
{
    /**
     * @Route(path="/index/{id}",methods={"GET"}, name="test.index")
     * @Value(variable="id",default="1")
     */
    function index($id)
    {
        return new JsonResponse($id);
    }
}

License

MIT, (*9)

The Versions

10/04 2017

dev-master

9999999-dev

It is a simple routing library using annotations and caching.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Naoto Owada

silex routing provider annotation

01/04 2017

1.1

1.1.0.0

It is a simple routing library using annotations and caching.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Naoto Owada

silex routing provider annotation

19/03 2017

1.0

1.0.0.0

It is a simple routing library using annotations and caching.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Naoto Owada

silex routing provider annotation