PHPackages                             smarch/omac - 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. smarch/omac

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

smarch/omac
===========

A simple ACL trait to allow authorization checks using whatever authorization package is desired. Currently supports Laravel Default, Shinobi, Sentinel and Entrust.

v1.0.2(10y ago)1512MITPHPPHP &gt;=5.5.9

Since Jan 29Pushed 10y ago2 watchersCompare

[ Source](https://github.com/SmarchSoftware/omac)[ Packagist](https://packagist.org/packages/smarch/omac)[ Docs](https://github.com/SmarchSoftware/omac)[ RSS](/packages/smarch-omac/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)DependenciesVersions (3)Used By (2)

This is probably only of use to me, but I have need of it in multiple apps so I packaged it up in case you want it too. :)

---

OMAC
====

[](#omac)

A simple trait to allow *basic* authorization checks using whatever authorization package is desired. Currently supports Laravel Default, Shinobi, Sentinel and Entrust.

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

[](#installation)

Installation is performed with composer.

#### 🔲 Composer

[](#black_square_button-composer)

```
composer require "smarch/omac"

```

Usage
-----

[](#usage)

Where you want to use OMAC to check access, add the trait.

```
class YourController extends Controller
{
    use \Smarch\Omac\OmacTrait;

```

Once you have the OmacTrait in use, and you are happy with the authorization driver you are using *(see parameters below)*, you can use the `checkAccess()` method of Omac by passing in the required permission to allow access.

#### Example of using OMAC to permit viewing an index of resources

[](#example-of-using-omac-to-permit-viewing-an-index-of-resources)

```
/**
 * Display a listing of the resources.
 *
 * @return Response
 */
public function index()
{
    if ( $this->checkAccess('view.index') ) {
        $resources = Model::all();
        return view("index", compact($resources) );
    }

    return view("unauthorized", ['message' => 'Not authorized to view Index'] );
    // OR
    return false;
    // OR
    abort(401, 'Unauthorized action.');

}

```

#### Arguments

[](#arguments)

The `checkAccess()` method accepts both the $permission and an $arguments variable. So if your preferred authorization package accepts a second argument to its method, you can use it.

```
    if ( $this->checkAccess('update.post', $post) ) {

```

> ✋ NOTE : Sentinel **only** accepts a $permission argument so you will not be able to pass in a second argument.

> ✋ NOTE : Entrust only accepts a boolean (true/false) as it second argument.

### Parameters (optional)

[](#parameters-optional)

By default, OMAC is set to *enabled* and to use *Laravel*'s built-in authorization can method. *(Gate)* If you wish to use a different authorization method, or to disable OMAC, you can change the parameters. You can do it in your class or method somewhere for a one-off usage, or you can set it on the constructor of your class to make the change for all the methods.

```
/**
 * constructor
 *
 * @param boolean acl Whether or not ACL is enabled
 * @param string $driver Which ACL package to use
 */
public function __construct() {
    $this->acl = false;
    $this->driver = "sentinel";
}

```

🔱 Why "OMAC"?
-------------

[](#trident-why-omac)

I've been a DC geek for over 30 years now. While OMAC in DC is more of a "big brother is watching" type of thing, it still fits nicely with **O**bject **M**anaged **A**ccess **C**ontrol. 😄

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

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

2

Last Release

3806d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4738992?v=4)[Jean-Guy Landriault](/maintainers/landjea)[@landjea](https://github.com/landjea)

---

Top Contributors

[![landjea](https://avatars.githubusercontent.com/u/4738992?v=4)](https://github.com/landjea "landjea (11 commits)")

---

Tags

laravelauthorizationaclentrustsentinelshinobiwatchtower

### Embed Badge

![Health badge](/badges/smarch-omac/health.svg)

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

###  Alternatives

[shanmuga/laravel-entrust

This package provides a flexible solution to add ACL to Laravel

69337.5k2](/packages/shanmuga-laravel-entrust)[casbin/laravel-authz

An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.

331368.6k4](/packages/casbin-laravel-authz)[pktharindu/nova-permissions

Laravel Nova Grouped Permissions (ACL)

136421.9k](/packages/pktharindu-nova-permissions)[hasinhayder/tyro

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

6783.6k6](/packages/hasinhayder-tyro)[efficiently/authority-controller

AuthorityController is an PHP authorization library for Laravel 5 which restricts what resources a given user is allowed to access.

15433.2k](/packages/efficiently-authority-controller)[smarch/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

523.0k](/packages/smarch-watchtower)

PHPackages © 2026

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