PHPackages                             alive2212/laravel-mobile-passport - 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. alive2212/laravel-mobile-passport

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

alive2212/laravel-mobile-passport
=================================

This is an illuminate package for one time authentication (OTP) with OAuth2 Base

v4.0.8(2y ago)33353MITPHP

Since Jul 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Alive2212/LaravelPassportAuth)[ Packagist](https://packagist.org/packages/alive2212/laravel-mobile-passport)[ Docs](https://github.com/alive2212/laravelmobilepassport)[ RSS](/packages/alive2212-laravel-mobile-passport/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (6)Versions (50)Used By (0)

LaravelMobilePassport
=====================

[](#laravelmobilepassport)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9f62fd9649d0375d4b59c77a3538cf8f469544775fa8dfc55890955ddb8b8b98/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c697665323231322f6c61726176656c6d6f62696c6570617373706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alive2212/laravelmobilepassport)[![Total Downloads](https://camo.githubusercontent.com/804db04983aabcda6ec2fef74f0f47ea2baeb0ce92a1d4d37a80a78b567096ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c697665323231322f6c61726176656c6d6f62696c6570617373706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alive2212/laravelmobilepassport)[![Build Status](https://camo.githubusercontent.com/8cb04a696872c00d7dfc5da1bdd9053c4c4bb19f1cba2f485974c2356322a873/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616c697665323231322f6c61726176656c6d6f62696c6570617373706f72742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/alive2212/laravelmobilepassport)[![StyleCI](https://camo.githubusercontent.com/cb13a877afd1dbe223c631789c3f922d3ace958fdb334a9cce9b26afefbc2ebd/68747470733a2f2f7374796c6563692e696f2f7265706f732f31323334353637382f736869656c64)](https://styleci.io/repos/12345678)

This is where your description should go. Take a look at [contributing.md](contributing.md) to see a to do list.

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

[](#installation)

Via Composer

```
$ composer require alive2212/laravel-mobile-passport
```

add to service provider 'config/app.php'

```
    'providers' => [
        ...

        /*
         * Authentication service
         */
        Alive2212\LaravelMobilePassport\LaravelMobilePassportServiceProvider::class,
    ],
```

if use Lumen add following service provider at then end of 'bootstrap/app.php'

```
$app->register(Alive2212\LaravelMobilePassport\LaravelMobilePassportServiceProvider::class);

$app->router->group([
    'namespace' => 'Alive2212\LaravelMobilePassport\Http\Controllers',
], function ($router) {
    require Alive2212\LaravelMobilePassport\LaravelMobilePassport::getDir() .
        '/lumen_routes.php';
});
```

migrate all database

```
$ php artisan migrate

```

add following code into AuthServiceProvider in 'boot' method

```
public function boot()
{
    $this->registerPolicies();

    Passport::routes();

    LaravelMobilePassport::initPassportTokenCan();

    LaravelMobilePassportSingleton::$otpCallBack = function (
        Request $request,
        User $user,
        AliveMobilePassportDevice $device,
        $token
    ) {
        // dispatch send sms job here to send notification

    };

    LaravelMobilePassportSingleton::$otpConfirmCallBack = function (
        Request $request,
        User $user,
        PersonalAccessTokenResult $token,
        ResponseModel $response
    ) {
        // put something here like update user name with request fields

    };

}
```

- tip: if ENV\_DEBUG in .env file set to false don't return any data in register by token

add 'phone\_number' &amp; 'country\_code' into model $fillable variable:

```
    protected $fillable = [
        'name',
        'email',
        'password',
        'phone_number',
        'country_code',
    ];
```

publish vendor files with following command:

```
php artisan vendor:publish --tag laravel-mobile-passport.lang
php artisan vendor:publish --tag laravel-mobile-passport.config
php artisan vendor:publish --tag laravel-mobile-passport.migrations
php artisan vendor:publish --tag laravel-mobile-passport.models

```

User model must be extended from BaseAuthModel

In the next step you should install following package and it's version related to your laravel version.

- phoenix/eloquent-meta
- fico7489/laravel-pivot

Add flowing code into `app\User.php`

```
    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function roles()
    {
        return $this->belongsToMany(
            AliveMobilePassportRole::class,
            'alive_mobile_passport_role_user',
            'user_id',
            'role_id'
        );
    }
```

Finally run following command to install passport dependency

```
$ art passport:install
```

Optional for add routes you can put following into boot method at AppServiceProvider

```
// add mobile passport routes
LaravelMobilePassport::routes(null,['middleware'=>'cors']);
```

Usage
-----

[](#usage)

1- create roles what you want in to alive\_mobile\_passport\_roles \*tip: title of roles must unique

You can use following to get current user scopes

```
$request['access_token'])
```

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Relation of this package with another one is:

- array helper -&gt; nothing
- laravel excel helper -&gt; nothing
- laravel onion pattern -&gt; nothing
- laravel query helper -&gt; nothing
- laravel reflection helper -&gt; nothing
- laravel request helper -&gt; nothing
- laravel string helper -&gt; nothing
- laravel smart response -&gt; array helper
- laravel smart restful -&gt; laravel excel helper, laravel onion pattern, laravel query helper, laravel reflection helper, laravel smart response, laravel string helper
- laravel passport auth -&gt; laravel smart restful

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

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits
-------

[](#credits)

- [author name](https://github.com/alive2212)
- [All Contributors](../../contributors%5D)

License
-------

[](#license)

license. Please see the [license file](license.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 98.3% 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 ~41 days

Recently: every ~143 days

Total

48

Last Release

895d ago

Major Versions

v1.0.27 → v2.0.02020-01-16

v2.0.3 → v3.0.02020-04-02

v3.0.7 → v4.0.02020-10-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/096cb0a90e1515fd7369bc03f9c36ce1cd55b64c3ac777400ea3997c28de83cc?d=identicon)[Alive2212](/maintainers/Alive2212)

---

Top Contributors

[![Alive2212](https://avatars.githubusercontent.com/u/5178290?v=4)](https://github.com/Alive2212 "Alive2212 (59 commits)")[![babaknodoust](https://avatars.githubusercontent.com/u/197913734?v=4)](https://github.com/babaknodoust "babaknodoust (1 commits)")

---

Tags

laravelLaravelMobilePassport

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alive2212-laravel-mobile-passport/health.svg)

```
[![Health](https://phpackages.com/badges/alive2212-laravel-mobile-passport/health.svg)](https://phpackages.com/packages/alive2212-laravel-mobile-passport)
```

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[corbosman/laravel-passport-claims

Add claims to Laravel Passport JWT Tokens

88655.9k](/packages/corbosman-laravel-passport-claims)[olssonm/l5-very-basic-auth

Laravel stateless HTTP basic auth without the need for a database

1662.5M1](/packages/olssonm-l5-very-basic-auth)[scaler-tech/laravel-saml2

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

2737.5k](/packages/scaler-tech-laravel-saml2)[schedula/laravel-passport-socialite

The missing laravel passport feature for social authentication

4922.6k](/packages/schedula-laravel-passport-socialite)[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)
