PHPackages                             iradoweck/moz-utils - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. iradoweck/moz-utils

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

iradoweck/moz-utils
===================

Utility functions for Mozambique — validation of NUIT, BI, documents, and phone number formatting

v0.3.3(1w ago)06↓100%AGPL-3.0-or-laterHTMLPHP ^8.2CI passing

Since May 22Pushed 6d agoCompare

[ Source](https://github.com/iradoweck/moz-utils)[ Packagist](https://packagist.org/packages/iradoweck/moz-utils)[ Docs](https://github.com/iradoweck/moz-utils)[ RSS](/packages/iradoweck-moz-utils/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (5)DependenciesVersions (13)Used By (0)

Moz-Utils
=========

[](#moz-utils)

 **Moz Utils Patch Dev** 🇲🇿

 [ ![License: AGPL v3](https://camo.githubusercontent.com/c61341f63648cdd5aba4f7a073b513106a63778c27b15f96c56157642bc943b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4147504c25323076332d626c75652e737667) ](https://www.gnu.org/licenses/agpl-3.0) [ ![PRs Welcome](https://camo.githubusercontent.com/25b3e6d0d42c98de74a98cbb4d149a1c09020cf6d1361993b72d7d5b8ffed363/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265) ](http://makeapullrequest.com) [ ![Mozambique](https://camo.githubusercontent.com/38b52b9f922732f8910c33877b483136f802095d291c07702838f69c2dee6f3e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d616465253230696e2d4d6f7a616d62697175652d7265643f6c6162656c436f6c6f723d626c61636b26636f6c6f723d303039363339) ](#)

 *The Definitive Swiss Army Knife for Software Developers in Mozambique.*

 `moz-utils` is a collection of essential utility functions tailored for the Mozambican software development ecosystem. It standardizes critical validations such as **NUIT** (Unique Tax Identification Number), **BI** (National ID), **DIRE** (Foreign Resident ID), **Passports**, **Driving Licenses**, **mobile phone numbers** (Vodacom, Tmcel, Movitel / M-Pesa, e-Mola, mKesh), **Metical currency formatting** (MZN), and **national geographical data** (including the New Postal Code System - CEP).

 The project is actively maintained and ported to the most popular programming languages used across Africa.

### ℹ️ Mozambique Specifications

[](#ℹ️-mozambique-specifications)

ParameterDetails**Country**Mozambique**Calling Code (DDI)**`+258`**Official Language**Portuguese (pt-MZ)**Official Currency**Metical (`MZN` / `MT`)---

🗺️ Workflows and Architecture
-----------------------------

[](#️-workflows-and-architecture)

All heavy technical logic (NUIT mathematics, document Regex validation, and Mozambique maps) has been isolated. To read detailed technical documentation on how algorithms work and the structure of Mozambican geographical databases, check out our official document: 👉 **[Mozambique Kiwi Docs (Validations &amp; Maps)](./mozambiquekiwi.md)**

### 1. Telephony and Mobile Wallets

[](#1-telephony-and-mobile-wallets)

Identification and validation of Mozambican 9-digit numbers (starting with 82, 83, 84, 85, 86, 87, 88). Robustly identifies if the number supports **M-Pesa** (Vodacom), **e-Mola** (Movitel), or **mKesh** (Tmcel).

### 2. Postal Codes (Legacy vs New CEP)

[](#2-postal-codes-legacy-vs-new-cep)

The ecosystem implements the **New Mozambican CEP System** (6 digits `XXXX-XX`). More than just a list, we built an intelligent suggestion logic:

- If a user inputs an old postal code (e.g., `3100`), the library automatically translates and suggests an *array* of corresponding New CEPs (e.g., `0909-01`, `0909-02`), allowing you to build perfect frontend dropdown menus for the end user to choose the exact neighborhood.

---

🚀 Interactive Emulator (CLI)
----------------------------

[](#-interactive-emulator-cli)

To test how this library behaves "in production" without needing to write code, we included a **CLI Emulator**.

Simply run this in the root of your project:

```
npx tsx emulator.ts
```

This will launch an interactive menu where you can type NUITs, phones, BIs, or CEPs and check the library's real-time response!

---

🌍 Ecosystems and Usage Examples
-------------------------------

[](#-ecosystems-and-usage-examples)

EcosystemFolderPackage ManagerPrimary Use Case**[TypeScript / JS](./ts)**`/ts`NPM / PNPM / YarnReact Web, Next.js, Node.js, Express**[Python](./python)**`/python`Pip / PoetryDjango, FastAPI, Data Science**[PHP](./php)**`/php`ComposerLaravel, Symfony, WordPress**[Dart](./dart)**`/dart`PubFlutter (Mobile Applications)**[Kotlin / Java](./kotlin)**`/kotlin`Gradle / MavenNative Android, Spring Boot---

📦 Quick Installation
--------------------

[](#-quick-installation)

 Get started immediately by installing the package for your preferred ecosystem:

=== "TypeScript" `bash npm install moz-utils `

=== "Python" `bash pip install moz-utils `

=== "PHP" `bash composer require iradoweck/moz-utils `

=== "Dart" `yaml # Add to your pubspec.yaml dependencies: moz_utils: ^0.3.3 `

=== "Kotlin" `kotlin // Add to your build.gradle.kts (JitPack) repositories { maven { url = uri("https://jitpack.io") } } dependencies { implementation("com.github.iradoweck:moz-utils:v0.3.3") } `

---

💻 Syntax Comparison
-------------------

[](#-syntax-comparison)

 Below is an example showing how homogeneous the API design is across all supported languages (TypeScript example with new features):

=== "TypeScript" ```typescript import { isValidNUIT, isValidDIRE, isValidMozambicanPhone, suggestCEPs, formatMZN } from 'moz-utils';

```
console.log(isValidNUIT('123456789')); // true
console.log(isValidDIRE(' 00008312-c ')); // true (auto-sanitized)
console.log(formatMZN(1500));          // "1 500,00 MT"
console.log(isValidMozambicanPhone('+258 841234567')); // true

// Auto-fallback and suggestions for legacy postal codes
const suggestions = suggestCEPs('3100');
console.log(suggestions[0]); // { cep: '0909-09', locality: 'Namutequeliua', district: 'Nampula', province: 'Nampula' }
```

```

---

🤝 Contribution and Portability
------------------------------

[](#-contribution-and-portability)

 `moz-utils` is an open-source project, and we would love to have your support to port it to more languages (such as **Go**, **Rust**, **Ruby**, or **C#**) or to optimize regex patterns and geographic databases!

 Please refer to our [Contribution Guide](./CONTRIBUTING.md) to learn more about:

\* The mathematical implementation of NUIT validation. \* Code style and naming conventions. \* Writing unit tests to maintain parity across ecosystems. ---

💬 Official Community &amp; Forum
--------------------------------

[](#-official-community--forum)

 We have a dedicated Community Portal integrated directly into our official website. Whether you have questions, ideas, want to showcase your projects, or propose B2B partnerships, everything happens there natively through GitHub Discussions.

👉 **[Join the Community Discussions](https://iradoweck.github.io/moz-utils/#/community)**

---

👥 Authors and Contributors
--------------------------

[](#-authors-and-contributors)

 This project was conceptualized and is maintained by:

 [ ![iradoweck](https://github.com/iradoweck.png) ](https://github.com/iradoweck "Edmilson Muacigarro (@iradoweck)") [ ![zedecks](https://github.com/zedecks.png) ](https://github.com/zedecks "Zedecks IT (@zedecks)")

---

📄 License
---------

[](#-license)

This project is licensed under the **AGPL-3.0-or-later** license.

---

 Developed by **Open Source Contributors** &amp; supported by **Edmilson Muacigarro**

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance98

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

7

Last Release

10d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b072129c57577fcad6859e71340edd922263cfd95bb79add165ced7887b512f9?d=identicon)[iradoweck](/maintainers/iradoweck)

---

Top Contributors

[![iradoweck](https://avatars.githubusercontent.com/u/38217572?v=4)](https://github.com/iradoweck "iradoweck (111 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (22 commits)")

---

Tags

bidistritosmeticaismoz-utilsmozambiquemultilanguagemznnuitprovinciasvalidationvalidationBImozambiquenuitprovinciatelecommoçambiquemznmeticaldistritos

### Embed Badge

![Health badge](/badges/iradoweck-moz-utils/health.svg)

```
[![Health](https://phpackages.com/badges/iradoweck-moz-utils/health.svg)](https://phpackages.com/packages/iradoweck-moz-utils)
```

###  Alternatives

[composer/semver

Version comparison library that offers utilities, version constraint parsing and validation.

3.3k510.9M888](/packages/composer-semver)[giggsey/libphonenumber-for-php

A library for parsing, formatting, storing and validating international phone numbers, a PHP Port of Google's libphonenumber.

5.0k156.0M484](/packages/giggsey-libphonenumber-for-php)[respect/validation

The most awesome validation engine ever created for PHP

6.1k39.0M405](/packages/respect-validation)[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k38.3M138](/packages/propaganistas-laravel-phone)[opis/json-schema

Json Schema Validator for PHP

64841.2M257](/packages/opis-json-schema)[giggsey/libphonenumber-for-php-lite

A lite version of giggsey/libphonenumber-for-php, which is a PHP Port of Google's libphonenumber

9015.3M63](/packages/giggsey-libphonenumber-for-php-lite)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
