organiseyou/name-service 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

organiseyou/name-service

最新稳定版本:v2.0

Composer 安装命令:

composer require organiseyou/name-service

包简介

README 文档

README

This is a library that convert the names that are used in projects.

Add service to an project

composer req organiseyou/name-service

Usage

Use it the service

$service = new Service('organise_you');

$capitals = $service->toDatabase();
//where $value is ORGANISE_YOU

$capitals = $service->toSlug();
//where $value is organise-you

$capitals = $service->toPascalCase();
//where $value is OrganiseYou

$capitals = $service->toCamelCase();
//where $value is organiseYou

Overwrite the default transformer

Sometimes we need to overwrite the default transformer

$service = new Service(
    'organise-you',
    fn (string $slug) => ConvertService::urlToName($slug)
);

$value = $service->toDatabase()
// where $value is ORGANISE_YOU

Use the static functions

Convert an name from url to an internal name

$internalName = Organiseyou\NameService\ConvertService::urlToName($name);

Convert an friendly written name to an internal name

$internalName = Organiseyou\NameService\ConvertService::saveConvert($name);

Convert an internal name to an url friendly name

$urlFriendlyName = ConvertService::convertNameToId($internalName);

Convert an internal name to a camelcase name

$camelCase = ConvertService::toCamelCase($internalName);

Run tests

To run the tests, first clone the project to an repository

git clone git@github.com:OrganiseYou/NameService.git

And go to the directory

cd NameService

Run composer install

php ./vendor/bin/phpunit tests

Upgrade v1 to v2

I did changed the class name, change the use case from

use Organiseyou\NameService\ConvertService;

to

use Organiseyou\NameService\Convert as ConvertService;

And remove Organiseyou\NameService and it is backwards compatible.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-09-10