承接 ride/lib-tokenizer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ride/lib-tokenizer

最新稳定版本:1.0.2

Composer 安装命令:

composer require ride/lib-tokenizer

包简介

Tokenizer library of the Ride framework.

README 文档

README

This library gives you some classes to parse a string into tokens.

Code Sample

Some example code in the context of the ORM module:

<?php

use ride\library\tokenizer\symbol\NestedSymbol;
use ride\library\tokenizer\symbol\SimpleSymbol;
use ride\library\tokenizer\Tokenizer;

$tokenizer = new Tokenizer();
$tokenizer->setWillTrimTokens(true);
$tokenizer->addSymbol(new SimpleSymbol('AND'));
$tokenizer->addSymbol(new SimpleSymbol('OR'));
$tokenizer->addSymbol(new NestedSymbol('(', ')', $tokenizer));

$condition = '{field} = %2% AND {field2} <= %1%';
$tokens = $tokenizer->tokenize($condition);
// array(
//    '{field} = %2%', 
//    'AND', 
//    '{field2} <= %1%'
// )

$condition = '{field} = 5 AND ({field2} <= %1% OR {field2} >= %2%)';
$tokens = $tokenizer->tokenize($condition);
// array(
//    '{field} = 5', 
//    'AND', 
//    array(
//        '{field2} <= %1%'), 
//        'OR', 
//        '{field2} >= %2%'),
//    )
// )

Implementations

For more examples, you can check the following implementation of this library:

Installation

You can use Composer to install this library.

composer require ride/lib-tokenizer

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 7
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-02-21