hamoi1/kurdish-converter
Composer 安装命令:
composer require hamoi1/kurdish-converter
包简介
This package provides a comprehensive solution for converting numbers into Kurdish Sorani words, making it easier to work with numbers in applications that require Kurdish language support. Convert English numbers to Kurdish Sorani text, currency, time, ordinal, percentage, and more.
README 文档
README
🌟 A comprehensive PHP package for converting numbers, currencies, time, and more into Kurdish Sorani language 🌟
📖 Description
Kurdish Converter is a powerful Laravel package that provides seamless conversion of numbers, currencies, time formats, ordinals, and percentages into beautiful Kurdish Sorani text. Perfect for applications targeting Kurdish-speaking users, this package makes it easy to localize your numeric data.
✨ Features
- 🔢 Number to Words: Convert integers and floats to Kurdish Sorani words
- 💰 Currency Formatting: Format monetary amounts with Kurdish currency names
- 🕐 Time Conversion: Convert time formats to Kurdish expressions
- 📊 Percentage Formatting: Display percentages in Kurdish format
- 🔢 Digit Conversion: Convert English digits to Kurdish/Arabic digits
- 📝 Ordinal Numbers: Convert numbers to ordinal format (first, second, etc.)
- 🛡️ Memory Safe: Built-in protection against memory exhaustion
- ⚡ Laravel Integration: Seamless Laravel service provider integration
🚀 Installation
Install the package via Composer:
composer require hamoi1/kurdish-converter
Laravel Auto-Discovery
The package will automatically register its service provider. If you need to register it manually, add it to your config/app.php:
'providers' => [ // ... Hamoi1\KurdishConverter\KurdishConverterServiceProvider::class, ],
Publish Configuration (Optional)
php artisan vendor:publish --provider="Hamoi1\KurdishConverter\KurdishConverterServiceProvider"
📋 Requirements
- PHP 8.3 or higher
- Laravel 10.0, 11.0, or 12.0
🎯 Usage
Basic Usage
use Hamoi1\KurdishConverter\Services\KurdishServiceConverter; // Convert numbers to Kurdish words echo KurdishServiceConverter::convertToWords(123); // Output: سەد و بیست و سێ // Convert digits to Kurdish/Arabic numerals echo KurdishServiceConverter::convertDigits(12345); // Output: ١٢٣٤٥ // Format currency echo KurdishServiceConverter::formatCurrency(1500, 'IQD'); // Output: هەزار و پێنج سەد دینار // Convert time echo KurdishServiceConverter::formatTime('14:30'); // Output: چواردە و نیو // Format percentage echo KurdishServiceConverter::formatPercentage(0.75); // Output: لە دەیا حەفتا و پێنج // Convert to ordinal echo KurdishServiceConverter::convertToOrdinal(3); // Output: سێیەم
Laravel Facade Usage
// If you want to use it as a facade app('kurdish')->convertToWords(456);
🔧 Available Methods
Number Conversion
// Convert integers and floats to Kurdish words KurdishServiceConverter::convertToWords(123); // سەد و بیست و سێ KurdishServiceConverter::convertToWords(123.45); // سەد و بیست و سێ و چەند
Digit Conversion
// Convert English digits to Kurdish/Arabic numerals KurdishServiceConverter::convertDigits('2024'); // ٢٠٢٤ KurdishServiceConverter::convertDigits(3.14); // ٣.١٤
Currency Formatting
// Format monetary amounts KurdishServiceConverter::formatCurrency(1000); // هەزار دینار KurdishServiceConverter::formatCurrency(500, 'USD'); // پێنج سەد دۆلار
Time Conversion
// Convert time to Kurdish format KurdishServiceConverter::formatTime('09:15'); // نۆ و چارەک KurdishServiceConverter::formatTime('12:30'); // دوانزە و نیو KurdishServiceConverter::formatTime('18:45'); // هەژدە و سێ چارەک
Percentage Formatting
// Format percentages KurdishServiceConverter::formatPercentage(0.25); // لە دەیا بیست و پێنج KurdishServiceConverter::formatPercentage(1.5); // یەک پەڕسەنت و نیو
Ordinal Numbers
// Convert to ordinal format KurdishServiceConverter::convertToOrdinal(1); // یەکەم KurdishServiceConverter::convertToOrdinal(2); // دووەم KurdishServiceConverter::convertToOrdinal(21); // بیست و یەکیەم
⚙️ Configuration
The package includes configurable currency names. After publishing the config file, you can customize currency mappings in config/kurdish-converter.php:
return [ 'currency_names' => [ 'IQD' => 'دینار', 'USD' => 'دۆلار', 'EUR' => 'یۆرۆ', // Add more currencies as needed ], ];
🛡️ Error Handling
The package includes built-in safety measures:
- Memory Protection: Prevents memory exhaustion with large numbers
- Input Validation: Validates input types and ranges
- Recursion Limits: Prevents infinite recursion
- Exception Handling: Provides meaningful error messages
try { $result = KurdishServiceConverter::convertToWords(999999999999999); } catch (\InvalidArgumentException $e) { echo "Error: " . $e->getMessage(); }
🧪 Testing
The package includes comprehensive tests covering all functionality.
Running Tests
Run all tests:
composer test
Run tests with coverage:
composer test-coverage
Run specific test suites:
# Run only unit tests ./vendor/bin/pest tests/Unit # Run only feature tests ./vendor/bin/pest tests/Feature
Test Structure
The package includes:
- Feature Tests: End-to-end testing of the main service
- Unit Tests: Individual testing of each helper class
- Edge Case Testing: Memory limits, recursion protection, error handling
🤝 Contributing
We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Setup
- Fork the repository
- Clone your fork
- Install dependencies:
composer install - Run tests:
composer test - Make your changes
- Run tests again and ensure they pass
- Submit a pull request
📝 License
This package is open-sourced software licensed under the MIT license.
👨💻 Author
Muhammad Esmael
- Email: ihama9728@gmail.com
- GitHub: @hamoi1
Made with ❤️ by Muhammad Esmael
Support Kurdish Language in Technology! 🌟
hamoi1/kurdish-converter 适用场景与选型建议
hamoi1/kurdish-converter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 06 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「numbers」 「converter」 「laravel」 「kurdish」 「kurdish-numbers」 「kurdish-words」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hamoi1/kurdish-converter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hamoi1/kurdish-converter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hamoi1/kurdish-converter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Tools to convert between .NET and PHP date formats
Encode integer IDs using a preset or customized symbol set
Partition problem for balanced arrays splitting made easy.
Rutils Symfony 2 bundle
TCMB Currenct Converter
Immutable PHP currency converter that's data-agnostic.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-15