定制 n0wada/chert 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

n0wada/chert

Composer 安装命令:

composer require n0wada/chert

包简介

It is a simple routing library using annotations and caching.

README 文档

README

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

Install

Chert uses Composer to install:

  "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.

chert.cache_lifetime

The lifetime in number of seconds for this cache entry. default lifetime is 0.

chert.controller_dirs

It is an array of pairs of namespace and directory.

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.

Usage

Resister Provider in your Silex application.

$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.

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

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固