khepin/drupal-transliterator-bundle
Composer 安装命令:
composer require khepin/drupal-transliterator-bundle
包简介
Symfony bundle to use drupal transliteration (eg in doctrine sluggable extension).
README 文档
README
This bundle provides a better transliterator than the one included in Doctrine
Extensions. This is useful for the Sluggable behavior if you are using a non
alphabetic based language. The one bundled in Doctrine extensions works fine
for many languages but I found limitations with Chinese at least. Drupal provides
a more advanced one.
Transliteration is the process of changing text from 北京 to Bei Jing. So that
it can be url formatted afterwards.
Installation
Through the deps files add:
[KhepinDrupalTransliteratorBundle]
git=https://github.com/khepin/KhepinDrupalTransliteratorBundle.git
target=/bundles/Khepin/DrupalTransliteratorBundle
Run your vendor script ./bin/vendors install.
In your autoload.php register the Khepin namespace:
$loader->registerNamespaces(array(
// ...
'Khepin' => __DIR__.'/../vendor/bundles',
// ...
));
There is no real need to register the bundle as all it provides is a class with static methods to transliterate strings. Having it autoloaded is enough.
Usage
The bundle provides a Transliterator class with two methods:
- One to just transliterate the text:
Khepin\DrupalTransliteratorBundle\Transliterator::transliterate - One that is compatible directly with the declaration in doctrine extensions
Khepin\DrupalTransliteratorBundle\Transliterator::sluggableTransliterate
The bundle also overrides the standard Doctrine Extensions Sluggable listener so that it uses this transliteration method rather than the standard one. In order to use it, change your DoctrineExtensionBundle to use the new listener:
stof_doctrine_extensions:
class:
sluggable: Khepin\DrupalTransliteratorBundle\Listener\SluggableListener
mongodb:
default:
sluggable: true
# or
orm:
default:
sluggable: true
khepin/drupal-transliterator-bundle 适用场景与选型建议
khepin/drupal-transliterator-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 26.21k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2012 年 04 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「slug transliteration」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 khepin/drupal-transliterator-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 khepin/drupal-transliterator-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 khepin/drupal-transliterator-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple library to sanitize text elements
TitleWithSlugInput - Easy Permalink Slugs for the FilamentPHP Form Builder (PHP / Laravel / Livewire)
i18n helpers (transliteration)
Adds slugify twig extensions to your craft install.
A library to extend Object capabilities.
A Laravel Filament Forms slug field.
统计信息
- 总下载量: 26.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPLv2
- 更新时间: 2012-04-14