vicent / laque-swahil-locale
Swahili locale helpers: ICU-based dates/numbers, lightweight inflector, terminology dictionary, and optional PSR-15 locale negotiation. Framework-agnostic, SOLID.
v1.0.0
2025-08-13 09:42 UTC
Requires
- php: >=8.1
- ext-intl: *
- ext-mbstring: *
- ext-simplexml: *
- nyholm/psr7: ^1.8
- nyholm/psr7-server: ^1.1
- psr/http-message: ^2.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-08-13 09:59:44 UTC
README
Framework‑agnostic, SOLID PHP library for Swahili localization:
- ICU/intl date, time, number, and currency formatting (with PHP fallback)
- Lightweight Swahili inflector (noun classes + passive verbs for UX)
- Terminology dictionary (Sw ↔ En)
- Optional PSR‑15 locale negotiation middleware
Author: Vicent Msomi msomivicent@gmail.com
Install
composer require vicent/laque-swahil-locale
Quick start
use Laque\SwahiliLocale\Locale\DateNumber\IntlDateNumberFormatter; use Laque\SwahiliLocale\Locale\Inflection\SwahiliInflector; use Laque\SwahiliLocale\Locale\Terms\Terminology; use Laque\SwahiliLocale\Locale\Terms\PhpFileLoader; $fmt = class_exists(\NumberFormatter::class) ? new IntlDateNumberFormatter('sw_TZ') : new Laque\SwahiliLocale\Locale\DateNumber\FallbackDateNumberFormatter('sw_TZ'); $infl = new SwahiliInflector(['mtumiaji'=>'watumiaji']); $terms = new Terminology(new PhpFileLoader(__DIR__.'/resources/terms')); echo $fmt->formatCurrency(1250000, 'TZS'); echo $infl->pluralizeNoun('kifurushi', 3); echo $terms->translate('Jina Kamili', 'sw_TZ', 'en_US');
MIT © 2025 Vicent Msomi
Packagist Auto-Update
- After publishing to GitHub, submit the repo to Packagist.
- In Packagist (Maintainer settings), enable GitHub Hook so new tags push updates automatically.
- Alternatively, create a Packagist API token and set up a GitHub Action to ping Packagist on tag (optional).
Examples
Run from repo root after composer install
:
php examples/formatting.php php examples/inflection.php php examples/terminology.php php examples/middleware-demo.php