承接 danbettles/php-reggie 相关项目开发

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

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

danbettles/php-reggie

Composer 安装命令:

composer require danbettles/php-reggie

包简介

Reggie is a very simple regular-expression builder

README 文档

README

Reggie is a very simple regular-expression (regex) builder for PHP. It was created to eliminate the clutter and confusion involved in assembling regexes from various different parts, to help prevent hard-to-find bugs and make code easier to understand.

Regexes can be confusing enough: having to also mentally-parse multiple complicated concatenation and interpolation operations makes things many times more difficult. That's where Reggie can help. Its fluent interface breaks things down into more distinct pieces, eliminates a ton of hieroglyphics, makes things more readable.

Examples

A few examples adapted from real-world code.

Note

For the sake of clarity and brevity, the following code uses literals as inputs. Consequently, some examples may appear simplistic—perhaps even pointless. Indeed, the benefits of using Reggie will become apparent only when regexes must be built from various variables, constants, etc.

PHP Pathnames

$regexStr = (new Builder())
    ->caseInsensitive()
    ->anchorEnd()
    ->addLiteral('.php')
    ->buildString()
;

// '~\.php$~i' === $regexStr

Project Paths to Ignore

$builder = new Builder();

$regexStr = $builder
    ->anchorStart()
    ->addLiteral("/path/to/project/")
    ->addSubpattern(
        $builder->listOfAlternatives(['vendor', 'var', 'node_modules'], quoteEach: true)
    )
    ->addLiteral('/')
    ->buildString()
;

// '~^/path/to/project/(vendor|var|node_modules)/~' === $regexStr

Usage

Builder

Generally speaking, the builder class provides two kinds of methods for building a regex:

  • methods that change the flags;
  • methods that add chunks (patterns or literals).

Important

Methods that add chunks have the prefix "add"; these must be called in the order you want the chunks to appear in the regex. Other methods can be called whenever makes sense to you.

danbettles/php-reggie 适用场景与选型建议

danbettles/php-reggie 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 207 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 danbettles/php-reggie 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 danbettles/php-reggie 我们能提供哪些服务?
定制开发 / 二次开发

基于 danbettles/php-reggie 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: ISC
  • 更新时间: 2025-11-19