PHPackages                             yaroslawww/laravel-restricted-access - 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. yaroslawww/laravel-restricted-access

Abandoned → [think.studio/laravel-restricted-access](/?search=think.studio%2Flaravel-restricted-access)Library

yaroslawww/laravel-restricted-access
====================================

Restrict access to any entities or pages, or create share links.

1.2.0(2y ago)06MITPHPPHP ^8.1

Since Jun 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dev-think-one/laravel-restricted-access)[ Packagist](https://packagist.org/packages/yaroslawww/laravel-restricted-access)[ Docs](https://github.com/dev-think-one/laravel-restricted-access)[ RSS](/packages/yaroslawww-laravel-restricted-access/feed)WikiDiscussions main Synced 1mo ago

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

Restrict access to any entities or pages, or create share links.
================================================================

[](#restrict-access-to-any-entities-or-pages-or-create-share-links)

[![Packagist License](https://camo.githubusercontent.com/9c977e5dc59429f455aa122751973b0e00237c41ce0e9cfe1a9a666801ebb24c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7468696e6b2e73747564696f2f6c61726176656c2d726573747269637465642d6163636573733f636f6c6f723d253233346463373166)](https://camo.githubusercontent.com/9c977e5dc59429f455aa122751973b0e00237c41ce0e9cfe1a9a666801ebb24c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7468696e6b2e73747564696f2f6c61726176656c2d726573747269637465642d6163636573733f636f6c6f723d253233346463373166)[![Packagist Version](https://camo.githubusercontent.com/64955f51f665aa6f2a10a3cb536c19df0addb75f3e81a9a7f9e8764243d28d38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468696e6b2e73747564696f2f6c61726176656c2d726573747269637465642d616363657373)](https://packagist.org/packages/think.studio/laravel-restricted-access)[![Total Downloads](https://camo.githubusercontent.com/5b921cd2d52db4ee218977afb982f685d74a59a1673cf7a66cff5ddde71b145e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468696e6b2e73747564696f2f6c61726176656c2d726573747269637465642d616363657373)](https://packagist.org/packages/think.studio/laravel-restricted-access)[![Build Status](https://camo.githubusercontent.com/573415793231f94012e16b3432e2afda88b0f935f31f5c85d5a142ca0a97901c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6c61726176656c2d726573747269637465642d6163636573732f6261646765732f6275696c642e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/laravel-restricted-access/build-status/main)[![Code Coverage](https://camo.githubusercontent.com/3431eb831a452923551ef7cb511eb874d5ed228b3c7f997b43bf4f1f927f84ac/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6c61726176656c2d726573747269637465642d6163636573732f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/laravel-restricted-access/?branch=main)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9aa55b85c170ede60ac6fb3a9d0e20db802c009040295f2b39f8f5f549c22b90/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6c61726176656c2d726573747269637465642d6163636573732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/laravel-restricted-access/?branch=main)

Restrict access for pages, with pin code, email or name.

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

[](#installation)

Install the package via composer:

```
composer require think.studio/laravel-restricted-access
```

Optionally you can publish the config file with:

```
php artisan vendor:publish --provider="LinkRestrictedAccess\ServiceProvider" --tag="config"
```

If you want change tables names or routes, you can do it via config file.

Run migrations:

```
php artisan migrate
```

Usage
-----

[](#usage)

Use trait `HasRestrictedLink` for model

```
class File extends Model
{
    use \LinkRestrictedAccess\Models\HasRestrictedLink;
}
```

Then you can create link

```
/** @var RestrictedLink $shareLink */
$shareLink = $file->restrictedLinks()->make([
    'name'         => $request->input('name'),
    'pin'          => $request->input('pin'),
    'check_pin'    => $request->boolean('check_pin'),
    'check_name'   => $request->boolean('check_name'),
    'check_email'  => $request->boolean('check_email'),
]);

if ($user = $request->user()) {
    $shareLink->meta->toMorph('creator', $user);
}

$shareLink->save();
```

Example check verification.

```
if($shareUuid = $request->string('share')) {

    $sharedLink = \LinkRestrictedAccess\RestrictedAccess::restrictedLinkModel()::query()->byKey($shareUuid)->firstOrFail();

    if ($sharedLink->needVerification() && !$sharedLink->verifiedOpenActionFromCookie($request)) {
        return // display verification view
    }

    return $sharedLink->linkable;
}
```

To verify access you can use routes `restricted-access-link.check-pin` and `restricted-access-link.open-document`

Credits
-------

[](#credits)

- [![Think Studio](https://camo.githubusercontent.com/8e541bece07d503c85a126b5294865faa00e27371048772f566a0cce8c01fd3a/68747470733a2f2f7961726f736c617777772e6769746875622e696f2f696d616765732f73706f6e736f72732f7061636b616765732f6c6f676f2d7468696e6b2d73747564696f2e706e67)](https://think.studio/)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Total

3

Last Release

1030d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23663794?v=4)[yaroslawww](/maintainers/yaroslawww)[@yaroslawww](https://github.com/yaroslawww)

---

Top Contributors

[![yaroslawww](https://avatars.githubusercontent.com/u/23663794?v=4)](https://github.com/yaroslawww "yaroslawww (5 commits)")

---

Tags

laravelaccessrestricted-access

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yaroslawww-laravel-restricted-access/health.svg)

```
[![Health](https://phpackages.com/badges/yaroslawww-laravel-restricted-access/health.svg)](https://phpackages.com/packages/yaroslawww-laravel-restricted-access)
```

###  Alternatives

[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)[spekkionu/laravel-zend-acl

Adds ACL to Laravel via Laminas\\Permissions\\Acl component.

4281.9k](/packages/spekkionu-laravel-zend-acl)

PHPackages © 2026

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