PHPackages                             emleons/tz\_namba - 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. emleons/tz\_namba

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

emleons/tz\_namba
=================

Simple php class to validate Tanzania phone numbers by cheking if it is well formated

v1.0.1(2y ago)119MITPHP

Since Jun 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/emleonstz/tzNambaValidator)[ Packagist](https://packagist.org/packages/emleons/tz_namba)[ RSS](/packages/emleons-tz-namba/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Tanzania Phone Number Validator
===============================

[](#tanzania-phone-number-validator)

This is a simple PHP library for validating Tanzania phone numbers. It uses check if a given phone number is well formated. by default it accepts the following formats: +255956413291 255696413291 0656913291 you can modify it per your needs by editing the file from src/ValidateNamba.php

Installation
------------

[](#installation)

To use this library, you need to have [Composer](https://getcomposer.org/) installed in your system. Once you have Composer installed, you can download the library by running the following command:

```
composer require emleons/tz_namba

```

Usage
-----

[](#usage)

Here is an example of how to use it:

```
require('vendor/autoload.php');
use Emleons\TzNamba\ValidateNamba;

$test = new ValidateNamba;
$phone = "+255752123456"; // Replace with the phone number you want to validate

if($test->validate($phone)){
    echo $phone." is a valid phone".'';
}else{
    echo $phone." is an invalid phone".'';
}
//sometimes you may want to remove prefix from phone numbers to do it use the remove_tz_prefix() method and pass your phone that follows accepted format
$removed_prefix = $test->remove_tz_prefix($phone);
echo "Removed prefix from ".$phone." to ".$removed_prefix;
```

Contributions
-------------

[](#contributions)

If you find a bug or have a feature request, please open an issue or submit a pull request.

Credits
-------

[](#credits)

Developed by Emleons email:

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~99 days

Total

2

Last Release

955d ago

### Community

Maintainers

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

---

Top Contributors

[![emleonstz](https://avatars.githubusercontent.com/u/64161260?v=4)](https://github.com/emleonstz "emleonstz (26 commits)")

---

Tags

phonephone-number

### Embed Badge

![Health badge](/badges/emleons-tz-namba/health.svg)

```
[![Health](https://phpackages.com/badges/emleons-tz-namba/health.svg)](https://phpackages.com/packages/emleons-tz-namba)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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