Download the PHP package etsh/groupable without Composer

On this page you can find all versions of the php package etsh/groupable. 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 groupable

Groupable

Groupable is a Laravel package for grouping content.

It takes its inspiration from the Drupal community - think of it as a simplified Organic Groups for Laravel.

Introduction

The idea of Groupable is to turn any Eloquent model into a group which can be 'joined' by users and act as a container for 'content'.

Addtionally, users may be given additional group roles on a group-by-group basis.

Groupable works by adding traits to the models within your application that you wish to adopt this group like behaviour.

The Traits

Groupable provides three traits which can be added to your models:

In fact, only the IsGroup trait is necessary in order to obtain group funtionality. However, the IsGroupable and JoinsGroups traits provide useful group related functionality to your user model and groupable content types.

Helper methods

Groupable includes a class called Groupable which offers internal helper methods. You likely won't need to use this class unless you intend to modify the code within this project yourself.

Database Structure

Groupable requires 3 tables to be added to your schema and includes database migrations out of the box.

There is no need to publish these migrations to your project as the accompanying service provider points to the migrations folder within your Composer vendor folder.

The table structure is as follows:

Installation

Installation is via composer:

Then be sure to include the GroupableServiceProvider in you a app config file:

Finally, run the migrations:

Instructions: Setup

Creating a Group

Simply use the IsGroup trait in the model that you wish to become a group:

Then create the properties $groupable_models and $groupable_roles:

$groupable_models should be an array containing the fully-qualified class name of the models which should be allowed to be grouped within this group. Groupable will throw an exception if you attempt to add a content type not specified here to the group.

$groupable_roles should be an array containing the names of additional roles that you wish members to be grantable to members of this group.

Creating Groupable content

Only models specified within the $groupable_models property on your group model may be added to a given group.

To add additional functionality use the IsGroupable trait on the model that represents your groupable content.

Allowing users to join groups

It's possible to join users to groups without using the 'CanJoinGroups' trait, however it provides some useful helper functions.

Include it in your user model like so:

Instructions: Usage

These instructions assume that you have used the IsGroupable trait in your groupable models and the JoinsTeams trait on your user model.

Add and remove group content

Content can be added to a group like this:

And removed like this:

Retrieve group content

You can retrieve all group content like this:

Which returns a Laravel collection containing each content model.

You can also make your content requests more specific by passing an array of required types to the content() method:

Join and leave a group

Users can be joined to groups like this:

And removed like this:

Retrieve group members

You can retrieve all group members like this:

Which returns a Laravel collection containing each user model.

You can also retrieve all group members with a given role:

Checking whether a user is a group member

You can check whether a user is a member of a given group like this:

Grant and revoke special group roles

You will probably want to grant some users special priveleges within your groups and this can be done in the following ways:

Users can be granted group roles like this:

And those roles can be revoked like this:

The available roles can be defined on a group by group basis and should be expressed by adding the required roles to the $groupable_roles property on the group model.

Checking whether a user has a group role

You can check whether a group member has a given group role like this:

Seeing which group roles a user has

You can see all roles a user has for a given group like this:

Checking which content types may be added to a group

You can check which content types may be added to a group like this:

Checking which roles are available within a group

You can check which roles are available within a group like this:

Finding the other groups that groupable content belongs to

You can retrieve a collection containing the other groups that a piece of groupable content belongs to like this:


All versions of groupable with dependencies

PHP Build Version
Package Version
No informations.
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 etsh/groupable contains the following files

Loading the files please wait ....