PHPackages                             inventas/momentum-lock - 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. inventas/momentum-lock

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

inventas/momentum-lock
======================

Expose Laravel authorization abilities on the frontend for Laravel Data resources.

v0.4.0(1mo ago)015↓90%MITPHPPHP ^8.3

Since Dec 15Pushed 1mo agoCompare

[ Source](https://github.com/Inventas/momentum-lock)[ Packagist](https://packagist.org/packages/inventas/momentum-lock)[ Docs](https://github.com/Inventas/momentum-lock)[ RSS](/packages/inventas-momentum-lock/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (9)Versions (7)Used By (0)

Momentum Lock
=============

[](#momentum-lock)

Momentum Lock is a Laravel package that lets you handle Laravel authorizations on the frontend level.

The package is only intended to work with [Laravel Data](https://github.com/spatie/laravel-data) objects and [TypeScript Transformer](https://github.com/spatie/laravel-typescript-transformer).

Note

Inventas maintains this repository as a fork of [`lepikhinb/momentum-lock`](https://github.com/lepikhinb/momentum-lock). We adopted the package because the upstream project appears inactive and we need ongoing Laravel support, including Laravel 13.

- [**Installation**](#installation)
    - [**Laravel**](#laravel)
    - [**Frontend**](#frontend)
- [**Usage**](#usage)
- [**Credits**](#credits)

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

[](#installation)

### Laravel

[](#laravel)

Install the package into your Laravel app.

```
composer require inventas/momentum-lock
```

This fork is tested against Laravel 12 and Laravel 13.

### Frontend

[](#frontend)

The frontend package is framework-agnostic and will work great within any TypeScript-powered workflow.

Install the upstream [frontend package](https://github.com/lepikhinb/momentum-lock-helper).

```
npm i momentum-lock
# or
yarn add momentum-lock
```

Usage
-----

[](#usage)

Extend your data classes from `DataResource` instead of `Data` provided by [Laravel Data](https://github.com/spatie/laravel-data).

```
use Momentum\Lock\Data\DataResource;

class UserData extends DataResource
{
    public function __construct(
        public int $id,
        public string $username
    ) {
    }
}
```

You can either specify the list of abilities manually, or let the package resolve them from the corresponding policy class.

```
class UserData extends DataResource
{
    protected $permissions = ['update', 'delete'];
}
```

Register `DataResourceCollector` in the TypeScript Transformer configuration file — `typescript-transformer.php`. This class helps TypeScript Transformer handle `DataResource` classes and append permissions to generated TypeScript definitions.

```
return [
    'collectors' => [
+       Momentum\Lock\TypeScript\DataResourceCollector::class,
        Spatie\TypeScriptTransformer\Collectors\DefaultCollector::class,
        Spatie\LaravelData\Support\TypeScriptTransformer\DataTypeScriptCollector::class,
    ],
]
```

On the frontend, you can use the helper `can`. This function checks whether the required permission is set to true on the passed object, and can be used in both scripts or templates.

```

import { can } from "momentum-lock"

const props = defineProps()

     Edit

```

Credits
-------

[](#credits)

- Original package by [Boris Lepikhin](https://github.com/lepikhinb)
- Maintained fork by [Inventas](https://github.com/Inventas)

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance90

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.2% 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 ~316 days

Total

5

Last Release

51d ago

PHP version history (2 changes)v0.1.0PHP ^8.1

v0.4.0PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![lepikhinb](https://avatars.githubusercontent.com/u/17538801?v=4)](https://github.com/lepikhinb "lepikhinb (13 commits)")[![LambdaDigamma](https://avatars.githubusercontent.com/u/19361610?v=4)](https://github.com/LambdaDigamma "LambdaDigamma (2 commits)")[![raymondmuller](https://avatars.githubusercontent.com/u/3808818?v=4)](https://github.com/raymondmuller "raymondmuller (1 commits)")[![ycs77](https://avatars.githubusercontent.com/u/38133356?v=4)](https://github.com/ycs77 "ycs77 (1 commits)")[![Yiddishe-Kop](https://avatars.githubusercontent.com/u/36875437?v=4)](https://github.com/Yiddishe-Kop "Yiddishe-Kop (1 commits)")

---

Tags

laravelauthorizationpermissionsinertiaInventas

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/inventas-momentum-lock/health.svg)

```
[![Health](https://phpackages.com/badges/inventas-momentum-lock/health.svg)](https://phpackages.com/packages/inventas-momentum-lock)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.5k](/packages/spatie-laravel-permission)[hasinhayder/tyro

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

6765.1k6](/packages/hasinhayder-tyro)[shanmuga/laravel-entrust

This package provides a flexible solution to add ACL to Laravel

69337.5k2](/packages/shanmuga-laravel-entrust)[amdadulhaq/guard-laravel

Guard is Role and Permission management system for Laravel

135.5k](/packages/amdadulhaq-guard-laravel)

PHPackages © 2026

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