Download the PHP package jurager/teams without Composer

On this page you can find all versions of the php package jurager/teams. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package teams

Jurager/Teams

Latest Stable Version Total Downloads PHP Version Require License

Laravel package to manage teams and operate with user permissions, abilities, supporting multi-tenant dynamic roles, roles groups, capabilities, and permissions for each team.

Users in teams can be combined into groups, with their own abilities, access rights given to a user group overrides the rights granted to a user in a team.

You can add a user to a global group to grant them access to all teams with the group's permissions. This feature is handy when you want to, for instance, provide support for all teams without assigning the user to created teams.

[!NOTE] The documentation for this package is currently being written. For now, please refer to this readme for information on the functionality and usage of the package.

Requirements

PHP >= 8.1 and Laravel 8.x or higher

Installation

Always do backups, next command may overwrite your actual data.

Run the migrations

Then, add the HasTeams trait to your existing User model.

To complete the installation process add the TeamPolicy to your existing AuthServiceProvider

Actions

Actions are predefined code blocks provided by the package to simplify common tasks in your application. Found in the app/Actions/Teams directory, these blocks can be easily invoked when users perform specific actions. They offer a quick way to implement functionality without starting from scratch. You can also customize or extend these actions to fit your needs precisely.

Explore the available actions and adapt them as necessary to maintain a clean and efficient codebase, speeding up your development process.

Teams

A team can be accessed via $user->team, providing methods for inspecting the team's attributes and relations:

These methods allow you to efficiently manage and interact with teams, including roles, users, permissions, and invitations.

Users

The Jurager\Teams\Traits\HasTeams trait provides methods to inspect a user's teams:

These methods enable you to efficiently manage and inspect a user's teams, roles, permissions, and abilities within your application.

Groups

Users within teams can be organized into groups, each with its own set of permissions.

[!NOTE]
Access rights granted to a group of users take precedence over rights granted to a user within a team.

Scope of Use

Groups Managing

The Jurager\Teams\Traits\HasTeams trait provides methods to inspect a user's team groups:

Groups Permissions

You can manage permissions within a group using the following methods:

[!NOTE] Team groups work together with abilities, so you should use ability checking methods to determine if users have specific access rights within groups.

Middleware ability is used to check the user's rights within the team group during requests to your application

Refer to the middlewares section in the documentation for more information.

Roles & Permissions

Roles and permissions provide a flexible way to manage access control within your application. Each team member added to a team can be assigned a role, and each role is associated with a set of permissions.

These roles and permissions are stored in your application's database, allowing for dynamic management of access control. This enables features like role and permission management within your application's administration pages.

Example: Creating a New Team with Roles and Permissions

In the above example, we create a new team and assign it two roles: "admin" and "user". Each role is associated with a set of capabilities that define what actions users with that role can perform within the application. These capabilities are stored in the database and can be managed dynamically.

The second argument for $team->addRole() is an array of capabilities, which determine the actions that users with the corresponding role can perform in the application.

Authorization

To ensure that incoming requests initiated by a team member can be executed by that user, the application needs to verify the permissions of the user's team. This verification can be done using the hasTeamPermission method, which is available through the Jurager\Teams\Traits\HasTeams trait.

[!NOTE]
In most cases, it's unnecessary to check a user's role directly. Instead, focus on verifying specific granular permissions. Roles primarily serve as a way to group granular permissions for organizational purposes. Typically, you'll execute calls to this method within your application's authorization policies.

This example demonstrates how to check if a user within a team has permission to update a server. Adjust the parameters according to your application's specific requirements and use cases.

Abilities

Adding abilities to users is straightforward. You don't need to create a role or an ability beforehand.

Simply pass the name of the ability, and the package will create it if it's not already existing.

Adding an Ability

To add the ability to edit an article within a team for a specific user, you need to provide the entity, such as the article object, and the team object:

Checking an Ability

To check if a user has a specific ability in a team, you can use the following method:

Forbidding an Ability

If you need to forbid a user from having a certain ability for instance, if the role abilities allow this ability, you can do so using the following method:

Creating Abilities

If you need to create abilities without attaching them to a user, you can use the Ability model provided by this package.

This model is published during installation, allowing you to create abilities separately:

Middlewares

Middleware Configuration

The middleware provided by this package is automatically registered as role, permission, and ability.

However, if you wish to use your own customized middlewares, you can modify the middleware.register in the config/teams.php.

Middleware Routes

You can use middleware to filter routes and route groups based on permissions or roles.

[!NOTE]
Consider, that team_id represents the actual ID of the team in the database.

If you need to customize the name of this variable, adjust the foreign_keys.team_id value in your config/teams.php file to match your database structure.

[!NOTE]
Middleware logic may vary based on how you pass the team_id variable.

Middleware Usage

For OR operations, use the pipe symbol:

For AND functionality:

To check the ability to perform an action on a specific model item, use the ability middleware:

In this case, pass article_id as a request parameter or route parameter to allow the package to identify the model object.

License

This package is open-sourced software licensed under the MIT license.


All versions of teams with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
illuminate/http Version ^8.0|^9.0|^10.0|^11.0
illuminate/bus Version ^8.0|^9.0|^10.0|^11.0
illuminate/mail Version ^8.0|^9.0|^10.0|^11.0
illuminate/queue Version ^8.0|^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jurager/teams contains the following files

Loading the files please wait ....