PHPackages                             foothing/laravel-lock-routes - 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. foothing/laravel-lock-routes

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

foothing/laravel-lock-routes
============================

Add route-based checks for Laravel Lock permissions.

0.3.0(9y ago)31741MITPHPPHP &gt;=5.5.9

Since Nov 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/foothing/laravel-lock-routes)[ Packagist](https://packagist.org/packages/foothing/laravel-lock-routes)[ RSS](/packages/foothing-laravel-lock-routes/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (8)Used By (1)

Laravel Lock Routes
===================

[](#laravel-lock-routes)

This is a Laravel 5 package that allows to bind `Lock` permissions to routes.

It implements a `Lock` provider for [Laravel Wrappr](https://github.com/foothing/laravel-wrappr).

Install
-------

[](#install)

```
composer require foothing/laravel-lock-routes

```

Setup
-----

[](#setup)

Add the `Wrappr` service provider in your`config/app.php` providers array.

```
'providers' => [
	// ...
	Foothing\Wrappr\WrapprServiceProvider::class
]
```

Publish package configuration and migration files

```
php artisan vendor:publish --provider="Foothing\Wrappr\WrapprServiceProvider"

```

Update your `config/wrappr.php`

```
'permissionsProvider' => 'Foothing\Wrappr\Lock\LockProvider',
'usersProvider' => 'Foothing\Wrappr\Providers\Users\DefaultProvider',
```

Middlewares
-----------

[](#middlewares)

There are two middleware use cases. You can use within Laravel Router or with complex pattern routes. More info in the [Wrappr documentation](https://github.com/foothing/laravel-wrappr).

### Enable Laravel Router Middleware

[](#enable-laravel-router-middleware)

```
protected $routeMiddleware = [
	'wrappr.check' => 'Foothing\Wrappr\Middleware\CheckRoute',
];
```

Use the CheckRoute Middleware to control access to your routes like the following **routes.php**:

```
Route::get('api/users', ['middleware:wrappr.check:admin.users', function() {
	// Access is allowed for the users with the 'admin.users' permission
}]);
```

The `CheckRoute` Middleware accepts 3 arguments:

- the required permission
- an optional resource name, i.e. 'user'
- an optional resource identifier (integer)

Example:

```
Route::get('api/users/{id?}', ['middleware:wrappr.check:read.users,user,1', function() {
	// Access is allowed for the users with the 'read.users' permission on
	// the 'user' resource with the {id} identifier
}]);
```

Also, the Middleware can handle your route arguments. Consider the following

```
Route::get('api/users/{id?}', ['middleware:wrappr.check:read.users,user,{id}', function() {
	// Access is allowed for the users with the 'read.users' permission on
	// the 'user' resource with the {id} identifier
}]);
```

When you pass a resource identifier within the brackets, the middleware will try to retrieve the value from the http request automatically.

### Enable custom routes Middleware

[](#enable-custom-routes-middleware)

When you're not able to fine-control at routes definition level, there's an alternative way of handling permissions. Think about a global RESTful controller like the following:

```
Route::controller('api/v1/{args?}', 'FooController');
```

Assume that your controller applies a variable pattern to handle the routes, like for example

```
GET /api/v1/resources/users
GET /api/v1/resources/posts
POST /api/v1/services/publish/post
```

In this case you won't be able to bind permissions with the previous method, so the `CheckPath` middleware comes to help. In order to enable this behaviour you need some additional setup step.

Add the global Middleware to your `App\Http\Kernel` like this

```
protected $middleware = [
	\Foothing\Wrappr\Middleware\CheckPath::class
];
```

Now you can configure your routes in the config file or programmatically following [the Wrappr routes documentation](https://github.com/foothing/laravel-wrappr).

ACL abstraction layer
---------------------

[](#acl-abstraction-layer)

If you want more decoupling from your app and the acl library (Lock in this case) you can use the acl manipulation methods that are implemented in the provider. See example:

```
$this->provider = \App::make('Foothing\Wrappr\Providers\Permissions\PermissionProviderInterface');

// Returns all the user's permissions
$this->provider->user($user)->all();

// Returns all the role's permissions
$this->provider->role('admin')->all();

// Allow the user to edit post with id = 1
$this->provider->user($user)->grant('edit', 'post', 1);

// Revoke previous permission
$this->provider->user($user)->revoke('edit', 'post', 1);

// Return false.
$this->provider->check($user, 'edit', 'post', 1);
```

License
-------

[](#license)

[MIT](https://opensource.org/licenses/MIT)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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

Total

5

Last Release

3298d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.4.0

0.1.1PHP &gt;=5.5.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ebf3a4938226620036760ed05bf0d6801b7bc2c383a1fd7dd1a4c48ba84145d?d=identicon)[brazorf](/maintainers/brazorf)

---

Top Contributors

[![brazorf](https://avatars.githubusercontent.com/u/3330031?v=4)](https://github.com/brazorf "brazorf (25 commits)")

---

Tags

laravelroutespermissionslock

### Embed Badge

![Health badge](/badges/foothing-laravel-lock-routes/health.svg)

```
[![Health](https://phpackages.com/badges/foothing-laravel-lock-routes/health.svg)](https://phpackages.com/packages/foothing-laravel-lock-routes)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

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

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

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

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

1.7k15.1M132](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[wnikk/laravel-access-rules

Simple system of ACR (access control rules) for Laravel, with roles, groups, unlimited inheritance and possibility of multiplayer use.

103.7k1](/packages/wnikk-laravel-access-rules)[beatswitch/lock-laravel

A Laravel Driver for Lock.

15629.8k1](/packages/beatswitch-lock-laravel)

PHPackages © 2026

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