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

This package is auto-updated.

Last update: 2025-08-13 09:59:44 UTC


README

codecov Latest Stable Version Total Downloads

Laque Swahili Locale logo

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