ashdevelops/php-case
最新稳定版本:v1.0.0
Composer 安装命令:
composer require ashdevelops/php-case
包简介
Composer package to detect case styles from arbitrary strings and convert them to other styles.
README 文档
README
caseconvert
A simple library for converting arbitrary case style texts to other cases.
Supported cases
- camelCase
- PascalCase
- snake_case
- kebab-case
- dot.case
Getting Started
Prerequisites
- PHP >= 8.1.0
Installation
Get it via composer:
composer require ashdevelops/php-case
Usage
Detect the case:
<?php use CaseConverter\CaseDetector; use CaseConverter\Validators\PascalCaseValidator; include 'vendor/autoload.php'; $arbitraryString = 'SomeArbitraryString'; $detector = new CaseDetector(new PascalCaseValidator()); echo $detector->detect($arbitraryString)->name; // string(6) "Pascal"
Snake case to camel:
<?php use CaseConverter\CaseType; use CaseConverter\Converters\CamelCaseConverter; include 'vendor/autoload.php'; $camelConverter = new CamelCaseConverter(); echo $camelConverter->convert('camel_case', CaseType::Snake); // string(9) "camelCase"
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Top contributors:
License
Distributed under the MIT License. See LICENSE.txt for more information.
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-08-14