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)21268[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 1mo 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

23

—

LowBetter than 27% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

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

659d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3bf4cf4ac033dabb7f11d9cc009342c1ae4a68a971cfcc0e1528919f0cd61019?d=identicon)[mohamad-zatar](/maintainers/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

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[olssonm/l5-very-basic-auth

Laravel stateless HTTP basic auth without the need for a database

1662.5M1](/packages/olssonm-l5-very-basic-auth)[stechstudio/laravel-jwt

Helper package that makes it easy to generate, consume, and protect routes with JWT tokens in Laravel

126117.6k](/packages/stechstudio-laravel-jwt)[scaler-tech/laravel-saml2

SAML2 Service Provider integration for Laravel applications, based on OneLogin toolkit

2737.5k](/packages/scaler-tech-laravel-saml2)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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