承接 rhdevelopment/inflecta 相关项目开发

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

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

rhdevelopment/inflecta

最新稳定版本:v0.1.0

Composer 安装命令:

composer require rhdevelopment/inflecta

包简介

Inflecta: lightweight string inflector utilities for modern PHP projects.

README 文档

README

Inflecta is a lightweight PHP 8.2+ string inflector that helps you convert between camelCase, snake_case, kebab-case, and title case while handling simple pluralization, singularization, and slug generation. It is perfect for REST APIs, CLI tooling, and framework-agnostic utilities that need consistent naming conventions.

Why Inflecta?

  • Zero dependencies and PSR-4 autoload ready.
  • Accurate delimiter normalization across spaces, underscores, and hyphens.
  • Case conversion helpers for camel, pascal, snake, constant, kebab, and title casing.
  • Simple pluralization and singularization rules for common English words.
  • Table/class naming helpers (classify, tableize) plus human-readable transformations and SEO-friendly slug creation.

Installation

composer require ryan/inflecta

Inflecta targets PHP 8.2 or newer. The package ships with a PHPUnit test suite for easy integration into continuous integration pipelines.

Quick Start

<?php

use Ryan\Inflecta\Inflecta;

Inflecta::toCamelCase('user_profile');          // userProfile
Inflecta::toPascalCase('user profile');         // UserProfile
Inflecta::toSnakeCase('HTTPResponseCode');      // http_response_code
Inflecta::toKebabCase('makeItSo');              // make-it-so
Inflecta::toTitleCase('customer_id');           // Customer Id
Inflecta::toConstantCase('statusFlag');         // STATUS_FLAG

Inflecta::pluralize('category');                // categories
Inflecta::singularize('boxes');                 // box
Inflecta::humanize('apiClient');                // Api client
Inflecta::slugify('Hello, World!');             // hello-world
Inflecta::classify('order_items');              // OrderItem
Inflecta::tableize('OrderItem');                // order_items

For a complete walkthrough, check the bundled example script:

php examples/demo.php

Testing

Inflecta includes PHPUnit tests covering every helper:

composer install
composer test

Contributing

Issues and pull requests are welcome on GitHub. Feel free to open a ticket if you spot an edge case or have ideas for new inflection rules.

License

MIT License © Ryan / RH Development.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-24