Download the PHP package iradoweck/moz-utils without Composer
On this page you can find all versions of the php package iradoweck/moz-utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iradoweck/moz-utils
More information about iradoweck/moz-utils
Files in iradoweck/moz-utils
Package moz-utils
Short Description Utility functions for Mozambique — validation of NUIT, BI, documents, and phone number formatting
License AGPL-3.0-or-later
Homepage https://github.com/iradoweck/moz-utils
Informations about the package moz-utils
Moz-Utils
Moz Utils Patch Dev 🇲🇿
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
| Parameter | Details |
|---|---|
| Country | Mozambique |
| Calling Code (DDI) | +258 |
| Official Language | Portuguese (pt-MZ) |
| Official Currency | Metical (MZN / MT) |
🗺️ 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 & Maps)
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)
The ecosystem implements the New Mozambican CEP System (6 digits XXXX-XX).
- 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.
3. Name & Document Sanitization
Clean up dirty user input from forms before saving to your database:
isValidName: Strictly validates Mozambican names (allowing apostrophes and hyphens).sanitizeName: Automatically normalizes spacing and forces perfect Title Case or UPPERCASE.sanitizeDocumentField&sanitizeAlphanumericField: Effortlessly strips invalid characters from BI or NUIT inputs.
4. Financial Toolkit (Metical)
Parse and format monetary values natively:
formatMZN(1500)->"1 500,00 MT"parseMZN("1.500,00 MT")->1500.00
🚀 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:
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
| Ecosystem | Folder | Package Manager | Status & Tracking (Insígnias) |
|---|---|---|---|
| TypeScript / JS | /ts |
NPM / PNPM | |
| Python | /python |
Pip / Poetry | |
| PHP | /php |
Composer | |
| Dart | /dart |
Pub | |
| Kotlin / Java | /kotlin |
Gradle / Maven |
📦 Quick Installation
Get started immediately by installing the package for your preferred ecosystem:
=== "TypeScript"
=== "Python"
=== "PHP"
=== "Dart"
=== "Kotlin"
🧮 O Algoritmo NUIT (A Verdadeira Fórmula Moçambicana)
Ao contrário do NIF de Portugal (que usa multiplicadores de 9 a 2), a Autoridade Tributária de Moçambique utiliza a seguinte matriz de pesos para calcular o Módulo 11 do NUIT.
A Fórmula e os Pesos Oficiais:
💻 Syntax Comparison
Below is an example showing how homogeneous the API design is across all supported languages (TypeScript example with new features):
=== "TypeScript"
🤝 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 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 & 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
👥 Authors and Contributors
This project was conceptualized and is maintained by:
📄 License
This project is licensed under the AGPL-3.0-or-later license.
Developed by Open Source Contributors & supported by Edmilson Muacigarro