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

successdav's avatar

Packages to manage user roles

Is it really necessary to use packages like spatie/laravel-permission to manage user role when I can do some basic stuffs like setup a roles table, roles_user table and assigne the roles there.

I just want your opinion if there is any special advantage to using packages to manage roles, thanks

0 likes
2 replies
gazd1977's avatar

For me the main reasons for using a package (particularly one as well used as spatie's) are:

  1. why re-invent the wheel
  2. you can access a lot of help (as lots of other people are using it)
  3. its well tested/developed (again as lots of people are using it)

The big disadvantage (from my POV - as I'm still very much in the learning phase with Laravel and php) is that if said package doesn't quite do what you want - it can be difficult tweak.

I guess everything is a trade off, you don't have to use packages for anything - you dont even need to use laravel.

jlrdw's avatar
jlrdw
Best Answer
Level 75

Is it really necessary to use packages like spatie/laravel-permission to manage user role

For a highly experienced programmer, no.

Some one new to programming - yes.

You have more than roles. You have to work out queries (I use query scopes) so a logged in user can only see or edit their own data. Just like this forum, I cannot edit your question.

So a logged in user is just that, but now the big question:

What can they do or not do.

In one app I recently did, I have a bookkeeper role and admin, etc.

The admin is not allowed to "mess around" with bookkeeping. So there is a learning curve how to fine tune who can do what.

If you are new to this: Use built in or spatie.

If you have 10 plus years experience at php or asp.net or java, role your own if you want.

Please or to participate in this conversation.