Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Zaheen's avatar
Level 21

Which package is best for roles & permissions

I am trying to figure out which package is best to use with laravel (for user roles and permission. I have read little bit about Sentry & Entrust), there are many more of these packages. So can someone recommend a solution which is having a good documentation and video tutorials.

Thank you

Zaheen

0 likes
38 replies
mstnorris's avatar

@zaheen what do you want to accomplish, as often, it is more difficult to try and shoehorn a fully-featured (big) third-party package into a smaller app, with smaller needs.

There are plenty of lessons here about users, and roles which may be of help to you. Again, it comes down to what you are building and what you're comfortable with. If you've read or at least seen the documentation then you can make up your own mind. The fact that you're asking this question says to me that you should start off small, and build upon that.

maytham's avatar

Depending on your project requirement, for small projects I use the one Jeffrey Way build on one of the lessons.

For project with more features and easy to understand Entrust is easy to start with.

And catalyst has almost every thing.

romanbican's avatar

@DMA It's very easy to create your own middleware and Laravel 5.1 provides middleware parameters.

3 likes
romanbican's avatar

Lol. Never heard of it. And you know why? Because my package is actually older, so it might be the other way round ;-). Please have a close look before you write something.

1 like
polarcubs's avatar

There was this package called lock-laravel by Dries Vints (Maintainer of Laravel.io)

https://github.com/BeatSwitch/lock-laravel

I didn't use it however as there were still some parts of the documentation I didn't really understand (Maybe someone can write a tutorial on it?) But it looks very flexible. Not sure how it compares to the packages mentioned by others.

@RomainLanz what will the next major release include?

1 like
jekinney's avatar

Imo sentry is NOT the solution for Laravel. It is a general PHP solution that is trying to fit into laravel. To much overhead and bloat.

Utilize ones like mentioned above if you feel the need. Most everyone I have worked with though has developed there own implementation. Generally speaking 3 to 4 tables and two models. Literally 10-20 lines of code and done. Granted it isn't the easiest thing to grasp for a beginner yet a fundamental requirement for any project.

If is is a really small app you can get by with a boolean values in a user or another related table.

3 likes
RomainLanz's avatar

@romanbican You maybe don't do that, it's just my impression. If you tell me that you have not I trust you. :)

@polarcubs I can't tell you all features, but you'll have dynamic conditions and dynamic permissions on resource, boilerplate panel, etc.

1 like
anon12822's avatar

@zaheen I recommend creating your own, it's easier to adapt than third party packages! Besides, if you like particular ideas from a several packages you can incorporate them into your own.

2 likes
wowrudy's avatar

i used romanbican roles package.. and it's awesome

1 like
Zaheen's avatar
Level 21

@maytham which package is by Jeff? Does anyone know any good video tutorials on how to use it with entrust or sentry?

maytham's avatar

@zaheen I follow this video https://laracasts.com/lessons/users-and-roles earlier, the same concept works on 5/5.1 with some modifications. but the good thing is that you do on your own and will perhaps understand the working mechanics. but again all depends your project requirement. I have also had some question regarding this video https://laracasts.com/discuss/channels/general-discussion/hashing-confusion and https://laracasts.com/discuss/channels/general-discussion/users-and-roles-1 that might help you too. good luck

1 like
Zaheen's avatar
Level 21

@maytham honestly I am not a good programmer, this is why I am trying to use a framework like Laravel to make things easier, infect I need a pre-build package for my authentication and authorization with roles and permission. https://github.com/BeatSwitch/lock-laravel seems interesting and promising but the problem for me is there is lack of tutorials on how to use it. Thank you very much for your support. I hope someone will come up with a clear guidance and tutorials. Thank you all for your smart responses.

mstnorris's avatar

@zaheen honestly, if as you say "I am not a good programmer" then you will find it harder to integrate another package rather than building your own. Of course this depends on the complexity.

1 like
jekinney's avatar

I would suggest a CMS instead of a framework. Unless your trying to become a programmer/developer.

Zaheen's avatar
Level 21

@mstnorris & @jekinney Thanks for your comment & suggestion, But I am trying to use Laravel instead of a CMS. I am very enthusiastic to learn and do it with Laravel.

jekinney's avatar

@kumarramalingam That is a bold statement. Sentry is a good package, but is not the best for every situation. Matter of fact I argue it is far from it for Laravel as Sentry is a PHP plugin not a laravel plugin. Lots of overhead, bloated file and script sizes. I would guess 50% of methods and function you will not use per app.

andy's avatar

Here is how I implemented the caffinated/shinobi package: https://github.com/illuminate3/rakko I've just added some dynamic menus and will be working on a cms module for my boiler/starter/basic application.

1 like
jasonfrye's avatar

Laravel 5.1.11 introduced Policy which should handle much of the role responsibility features. I'm sure Jeffrey will be doing a lesson on it soon, as it seems like an incredible update.

Take a look at the docs. It likely handles most of the sticky problems people encounter when building their own auth system.

Laravel Authorization - Policy

Next

Please or to participate in this conversation.