PHPackages                             mohamad-zatar/saudi-nafath-integration - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. mohamad-zatar/saudi-nafath-integration

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

mohamad-zatar/saudi-nafath-integration
======================================

A Laravel package for integrating with the Saudi Nafath service, providing seamless identity verification and authentication solutions.

v1.0.x-dev(1y ago)25289[2 issues](https://github.com/mohamad-zatar/saudi-nafath-integration/issues)MITPHPPHP ^7.4|^8.0

Since Jul 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mohamad-zatar/saudi-nafath-integration)[ Packagist](https://packagist.org/packages/mohamad-zatar/saudi-nafath-integration)[ RSS](/packages/mohamad-zatar-saudi-nafath-integration/feed)WikiDiscussions v1.0 Synced 2d ago

READMEChangelog (1)Dependencies (1)Versions (1)Used By (0)

Laravel Nafath Integration Package
==================================

[](#laravel-nafath-integration-package)

This Laravel package provides an integration with the Saudi Nafath authentication system. It allows you to easily manage user authentication via Nafath and handle verification callbacks.

Features
--------

[](#features)

- Send authentication requests to Nafath.
- Handle verification callbacks and update user statuses.
- Dispatch events for custom handling of verification success and rejection.

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

[](#installation)

### 1. Install the Package

[](#1-install-the-package)

You can install the package via Composer. Run the following command in your Laravel project:

```
composer require mohamad-zatar/nafath
```

### 2. Publish the Configuration

[](#2-publish-the-configuration)

Publish the package configuration file to customize it according to your needs:

```
php artisan vendor:publish --provider="MohamadZatar\Nafath\NafathServiceProvider"
```

This will create a nafath.php configuration file in your config directory.

Configuration
-------------

[](#configuration)

### 1. Add Configuration

[](#1-add-configuration)

In the config/nafath.php file, set your Nafath API URL base and API key:

```
return [
    'NAFATH_URL_BASE' => env('NAFATH_URL_BASE', 'your-subdomain'),
    'NAFATH_API_KEY' => env('NAFATH_API_KEY', 'your-api-key'),
];
```

Add these values to your .env file:

```
NAFATH_URL_BASE=your-subdomain
NAFATH_API_KEY=your-api-key
```

### 2. Migration

[](#2-migration)

Publish the migration for the nafath\_logins table:

```
php artisan migrate
```

Usage
-----

[](#usage)

### 1. Sending Login Requests

[](#1-sending-login-requests)

To send a login request to Nafath, use the NafathController provided by the package. You can use this controller to handle authentication requests.

### 2. Handling Callbacks

[](#2-handling-callbacks)

Handle the callback from Nafath by defining the callback URL in your Nafath dashboard and configuring it to point to your application endpoint. The endpoint should be handled by the nafathPostCallback method in NafathController.

### 3. Event Handling

[](#3-event-handling)

The package dispatches two events that you can listen to in your application:

- MohamadZatar\\Nafath\\Events\\VerificationVerified
- MohamadZatar\\Nafath\\Events\\VerificationRejected

#### Define Listeners

[](#define-listeners)

Create listeners for these events in your Laravel application:

```
// app/Listeners/HandleVerificationVerified.php
namespace App\Listeners;

use MohamadZatar\Nafath\Events\VerificationVerified;

class HandleVerificationVerified
{
    public function handle(VerificationVerified $event)
    {
        // Custom logic for verification success
    }
}

// app/Listeners/HandleVerificationRejected.php
namespace App\Listeners;

use MohamadZatar\Nafath\Events\VerificationRejected;

class HandleVerificationRejected
{
    public function handle(VerificationRejected $event)
    {
        // Custom logic for verification rejection
    }
}
```

#### Register Event Listeners

[](#register-event-listeners)

Add your listeners to the EventServiceProvider:

```
// app/Providers/EventServiceProvider.php
protected $listen = [
    VerificationVerified::class => [
        HandleVerificationVerified::class,
    ],
    VerificationRejected::class => [
        HandleVerificationRejected::class,
    ],
];
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please submit a pull request or create an issue for any bugs or feature requests.

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

Contact
-------

[](#contact)

For any questions or support, please contact Mohamad Zatar at .

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

711d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/112317706?v=4)[Mohamad Zatar](/maintainers/mohamad-zatar)[@mohamad-zatar](https://github.com/mohamad-zatar)

---

Top Contributors

[![mohamad-zatar](https://avatars.githubusercontent.com/u/112317706?v=4)](https://github.com/mohamad-zatar "mohamad-zatar (8 commits)")

### Embed Badge

![Health badge](/badges/mohamad-zatar-saudi-nafath-integration/health.svg)

```
[![Health](https://phpackages.com/badges/mohamad-zatar-saudi-nafath-integration/health.svg)](https://phpackages.com/packages/mohamad-zatar-saudi-nafath-integration)
```

###  Alternatives

[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5752.3M18](/packages/directorytree-ldaprecord-laravel)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[althinect/filament-spatie-roles-permissions

3481.1M10](/packages/althinect-filament-spatie-roles-permissions)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6804.7k6](/packages/hasinhayder-tyro)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1563.2k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

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