Download the PHP package timgavin/laravel-block without Composer

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

Laravel Block

Latest Version on Packagist Total Downloads Tests

A simple Laravel package for blocking users.

Requirements

Installation

Via Composer

Import Laravel Block into your User model and add the trait.

Then run migrations.

Configuration

Publish the config file.

Available options:

Usage

Block a user

Returns true if the user was blocked, false if already blocking.

Unblock a user

Returns true if the user was unblocked, false if not blocking.

Toggle block

Returns true if now blocking, false if unblocked.

Check if a user is blocking another user

Check if a user is blocked by another user

Check if users are mutually blocking each other

Check if there is any block relationship between two users

Get blocking count

Get blockers count

Get the users a user is blocking

Get the users a user is blocking with pagination

Get the users who are blocking a user

Get the users who are blocking a user with pagination

Get the most recent users who are blocking a user

Get an array of IDs of the users a user is blocking

Get an array of IDs of the users who are blocking a user

Get an array of IDs of both blocking and blockers

Get all user IDs involved in any block relationship (single query)

Useful for feed exclusion - returns IDs of users you're blocking AND users blocking you.

Get block status for multiple users in batch

Returns status for multiple users in just 2 queries instead of 2N. Useful for API responses.

Get block status for a single user

Returns bidirectional block status in a single query. Useful for profile pages.

Query Scopes

Exclude blocked users from queries

Excludes users involved in any block relationship with the given user.

Relationships

Access the blocks relationship (users this user is blocking).

Access the blockers relationship (users blocking this user).

Get the block relationship record where this user blocks another.

Get the block relationship record where another user blocks this user.

Get all block relationships between two users.

Caching

Cache the IDs of the users a user is blocking. Default duration is set in config.

Get the cached IDs of the users a user is blocking.

Cache the IDs of the users who are blocking a user.

Get the cached IDs of the users who are blocking a user.

Clear the Blocking cache.

Clear the Blockers cache.

Clear the Blockers cache for another user. Useful after blocking a user to keep their blockers cache in sync.

Clear the Blocking cache for another user.

Note: The cache is automatically cleared when calling block() or unblock(). However, only the current user's cache is cleared. Use clearBlockersCacheFor() to clear the target user's blockers cache if needed.

Events

Events are dispatched when users block or unblock each other.

Disable events in config.

Query Scopes

Query scopes are available on the Block model.

Upgrading

If upgrading from 1.x, please see the upgrade guide.

Change log

Please see the changelog for more information on what has changed recently.

Testing

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

MIT. Please see the license file for more information.


All versions of laravel-block with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 timgavin/laravel-block contains the following files

Loading the files please wait ...