PHPackages                             neamatrix/connex - 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. neamatrix/connex

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

neamatrix/connex
================

Laravel package for Connex DCB login: protected-script, OTP via login-connex, confirm via login-confirm, customizable login UI, mobile Sanctum tokens.

v1.1.0(2w ago)012MITPHPPHP ^8.2

Since May 20Pushed 2w agoCompare

[ Source](https://github.com/NeaMatrix/connex-package)[ Packagist](https://packagist.org/packages/neamatrix/connex)[ Docs](https://github.com/NeaMatrix/connex-package)[ RSS](/packages/neamatrix-connex/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (5)Used By (0)

neamatrix/connex
================

[](#neamatrixconnex)

Laravel package for Connex DCB login: server-side `auth-login` + `protected-script`, browser-only `dcbprotect` / `gateway-load`, server-side `login-connex` + `login-confirm-connex`, customizable login UI, mobile Sanctum tokens.

Database (users table)
----------------------

[](#database-users-table)

Package migrations add Connex subscriber fields from OTP confirm `success`:

ColumnExampleSource`msisdn``218920920110``success.msisdn``subscriber``exist``success.subscriber``status``active``success.status``operator``Libyana``success.operator``expiration_date``2032-08-11 15:56:54``success.expiration_date````
php artisan migrate
```

Migrations live in `packages/torgodly/connex/database/migrations/` (auto-loaded by the package).

Ensure your `User` model includes these in `$fillable` (and `expiration_date` cast as `datetime`).

Tests
-----

[](#tests)

From the Laravel app root:

```
php artisan test
```

Covers URL building, upstream HTTP (faked), user sync, OTP confirm API, Sanctum token issuance, and the login page.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 10, 11, 12, or 13
- [laravel/sanctum](https://github.com/laravel/sanctum) (recommended for mobile API tokens after OTP confirm)

Install
-------

[](#install)

### From Packagist (after package is submitted)

[](#from-packagist-after-package-is-submitted)

Submit `https://github.com/NeaMatrix/connex-package` on [Packagist.org](https://packagist.org/), then:

```
composer require neamatrix/connex:^1.1
php artisan vendor:publish --tag=connex-config
php artisan migrate
composer require laravel/sanctum
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
php artisan migrate
```

### Before Packagist / dev install

[](#before-packagist--dev-install)

If you see *"Could not find a version matching minimum-stability (stable)"*, use the GitHub repo directly:

```
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/NeaMatrix/connex-package.git"
    }
]
```

```
composer require neamatrix/connex:^1.1
```

Or allow dev stability once:

```
composer require neamatrix/connex:dev-main
```

### Local path (development)

[](#local-path-development)

```
"repositories": [
    {
        "type": "path",
        "url": "packages/torgodly/connex",
        "options": { "symlink": true }
    }
],
"require": {
    "neamatrix/connex": "@dev"
}
```

Environment
-----------

[](#environment)

### Upstream endpoints

[](#upstream-endpoints)

Each call uses `CONNEX_BASE_URL` + `CONNEX_*_ENDPOINT`.

PurposeEnvDefaultAuth token`CONNEX_AUTH_LOGIN_ENDPOINT``/auth-login`DCB script`CONNEX_PROTECTED_SCRIPT_ENDPOINT``/protected-script`Send OTP`CONNEX_LOGIN_CONNEX_ENDPOINT``/login-connex`Confirm OTP`CONNEX_LOGIN_CONFIRM_ENDPOINT``/login-confirm-connex````
CONNEX_BASE_URL=https://jobassistant.mooo.com
CONNEX_AUTH_LOGIN_ENDPOINT=/auth-login
CONNEX_PROTECTED_SCRIPT_ENDPOINT=/protected-script
CONNEX_LOGIN_CONNEX_ENDPOINT=/login-connex
CONNEX_LOGIN_CONFIRM_ENDPOINT=/login-confirm-connex
```

```
CONNEX_AUTH_EMAIL=your@api.user
CONNEX_AUTH_PASSWORD=secret
CONNEX_WEB_LOGIN_PATH=/connex/login
CONNEX_DEBUG_LOG=true
CONNEX_SUBMIT_BUTTON_ID=cta_button
```

Browser vs server (v1.1+)
-------------------------

[](#browser-vs-server-v11)

StepWhere it runs`auth-login`, `protected-script`, `login-connex`**Laravel** (`POST /connex/api/bootstrap`, `POST /connex/api/request-otp`)`dcbprotect` script + `DCBProtectRun` + `gateway-load`**Browser** (antifraud; credentials never sent to the client)`login-confirm-connex`**Laravel** (`POST /connex/api/confirm-otp`)`ConnexLoginConfig` exposes only Laravel API URLs + CSRF + selectors — not `CONNEX_AUTH_EMAIL`, `CONNEX_AUTH_PASSWORD`, or upstream URLs.

Default login page
------------------

[](#default-login-page)

Package registers `GET {CONNEX_WEB_LOGIN_PATH}` (default `/connex/login`) → `connex::login`.

Custom login page (design in your Blade view)
---------------------------------------------

[](#custom-login-page-design-in-your-blade-view)

**All layout and CSS live in your view** — not in `config/connex.php`. The package only requires correct **element IDs** (from `connex.selectors`) and the submit button **outside** the hidden phone/OTP step wrappers.

Publish the example and edit it:

```
php artisan vendor:publish --tag=connex-views
```

Copy `resources/views/vendor/connex/login.blade.php` to e.g. `resources/views/my-login.blade.php`, change classes/markup freely, then:

```
CONNEX_LOGIN_VIEW=my-login
```

**Minimal custom page:**

```

My login

        @include('connex::partials.hidden-fields')

            Check your SMS

        Please wait…

```

- `data-connex-hidden-class` on `` must match the class you use to hide steps (e.g. Tailwind `hidden`, Bootstrap `d-none`, or your own `is-hidden`).
- Button `data-connex-enabled-class` / `data-connex-disabled-class` are optional; JS swaps them when enabling/disabling the button.

**Without the component** — same markup, end with:

```
@include('connex::partials.hidden-fields')
@include('connex::partials.scripts')
```

Wrap markup in `` so step toggling works.

Required elements (configurable via `config/connex.php` → `selectors`):

PurposeDefault id / nameMSISDN input`#msisdn`Submit button`#cta_button` — must stay **outside** hidden phone/otp step wrappers (default layout does this)Transaction`#transaction_identify`Device type`name="device_type"` value `web`OTP + mobile login
------------------

[](#otp--mobile-login)

1. Page load → `POST /connex/api/bootstrap` (fresh `transaction_identify` + `dcbprotect`).
2. User submits phone → `POST /connex/api/request-otp` (server calls `login-connex`; OTP sent).
3. UI **automatically switches** to the OTP field (`#otp` in `#connex_otp_step`; button label becomes “Verify OTP”).
4. User submits OTP → `POST /connex/api/confirm-otp` (Laravel):
    - Calls upstream `login-confirm-connex` with `msisdn` + `otp` + `device_type`
    - Creates/updates local user from Connex `success` payload
    - Issues Sanctum token for the mobile app
    - Runs your `HandlesOtpConfirmation` handler for custom JSON

### Custom OTP handling

[](#custom-otp-handling)

Implement `Torgodly\Connex\Contracts\HandlesOtpConfirmation` and bind it:

```
$this->app->bind(HandlesOtpConfirmation::class, YourHandler::class);
```

```
public function handle(Authenticatable $user, array $connexSuccess): array
{
    // Return extra keys merged into the API response (redirect URLs, app flags, etc.)
    return ['app' => ['tier' => 'premium']];
}
```

### Mobile API response (`POST /connex/api/confirm-otp`)

[](#mobile-api-response-post-connexapiconfirm-otp)

```
{
  "messageCode": "00",
  "success": { "message": "OTP confirmed", "connex": { "msisdn": "218...", "status": "active", ... } },
  "auth": {
    "token": "1|plainTextToken...",
    "token_type": "Bearer",
    "expires_at": null,
    "user": { "id": 1, "msisdn": "218...", "status": "active", "operator": "Libyana", "expiration_date": "..." }
  },
  "app": { }
}
```

Mobile app: store `auth.token`, send `Authorization: Bearer {token}` on API calls.

### Web hook

[](#web-hook)

```
document.addEventListener('connex:authenticated', function (e) {
  console.log(e.detail.auth.token);
});
```

Changelog
---------

[](#changelog)

### v1.1.2

[](#v112)

- UI: design only in Blade views — `` is a thin wrapper; removed `connex.ui.classes` config and styled partials.

### v1.1.1

[](#v111)

- Fix: OTP confirm updates existing users matched by `msisdn` **or** `{msisdn}@connex.local` email (no duplicate email error).

### v1.1.0

[](#v110)

- **Security:** upstream auth, protected-script, and login-connex run on the server; browser only runs `dcbprotect` / `gateway-load`.
- New API routes: `POST {CONNEX_API_PREFIX}/bootstrap`, `POST …/request-otp`.
- Default confirm upstream path: `/login-confirm-connex` (`CONNEX_LOGIN_CONFIRM_ENDPOINT`).

### v1.0.2

[](#v102)

- Send `device_type` on login-confirm upstream request.

### v1.0.1

[](#v101)

- Fix: Sign In button visible on OTP step.

### v1.0.0

[](#v100)

- Initial release.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance96

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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 ~0 days

Total

4

Last Release

19d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/57685643?v=4)[Abdullah al-hajj](/maintainers/torgodly)[@torgodly](https://github.com/torgodly)

---

Top Contributors

[![torgodly](https://avatars.githubusercontent.com/u/57685643?v=4)](https://github.com/torgodly "torgodly (7 commits)")

---

Tags

laravelotploginmsisdndcbconnexmobile auth

### Embed Badge

![Health badge](/badges/neamatrix-connex/health.svg)

```
[![Health](https://phpackages.com/badges/neamatrix-connex/health.svg)](https://phpackages.com/packages/neamatrix-connex)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k28.4M134](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M120](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9732.3M121](/packages/roots-acorn)[laravel/cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

268880.7k3](/packages/laravel-cashier-paddle)[api-platform/laravel

API Platform support for Laravel

59156.3k10](/packages/api-platform-laravel)

PHPackages © 2026

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