Download the PHP package cybercog/laravel-ban without Composer

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

Laravel Ban

cog-laravel-ban

Discord Releases Build StyleCI Code Quality License

Introduction

Laravel Ban simplify management of Eloquent model's ban. Make any model bannable in a minutes!

Use case is not limited to User model, any Eloquent model could be banned: Organizations, Teams, Groups and others.

Contents

Features

Installation

First, pull in the package through Composer:

Registering package

The package will automatically register itself. This step required for Laravel 5.4 or earlier releases only.

Include the service provider within app/config/app.php:

Apply database migrations

At last, you need to publish and run database migrations:

Usage

Prepare bannable model

Prepare bannable model database table

Bannable model must have nullable timestamp column named banned_at. This value used as flag and simplify checks if user was banned. If you are trying to make default Laravel User model to be bannable you can use example below.

Create a new migration file

Then insert the following code into migration file:

Available methods

Apply ban for the entity

Apply ban for the entity with reason comment

Apply ban for the entity which will be deleted over time

expired_at attribute could be \Carbon\Carbon instance or any string which could be parsed by \Carbon\Carbon::parse($string) method:

Remove ban from entity

On unban all related ban models are soft deletes.

Check if entity is banned

Check if entity is not banned

Delete expired bans manually

Determine if ban is permanent

Or pass null value.

Determine if ban is temporary

Scopes

Get all models which are not banned

Get banned and not banned models

Get only banned models

Scope auto-apply

To apply query scopes all the time you can define shouldApplyBannedAtScope method in bannable model. If method returns true all banned models will be hidden by default.

Events

If entity is banned \Cog\Laravel\Ban\Events\ModelWasBanned event is fired.

Is entity is unbanned \Cog\Laravel\Ban\Events\ModelWasUnbanned event is fired.

Middleware

This package has route middleware designed to prevent banned users to go to protected routes.

To use it define new middleware in $routeMiddleware array of app/Http/Kernel.php file:

Then use it in any routes and route groups you need to protect:

If you want force logout banned user on protected routes access, use LogsOutBannedUser middleware instead:

Scheduling

After you have performed the basic installation you can start using the ban:delete-expired command. In most cases you'll want to schedule these command so you don't have to manually run it everytime you need to delete expired bans and unban models.

The command can be scheduled in Laravel's console kernel, just like any other command.

Of course, the time used in the code above is just example. Adjust it to suit your own preferences.

Integrations

Changelog

Please see CHANGELOG for more information on what has changed recently.

Upgrading

Please see UPGRADING for detailed upgrade instructions.

Contributing

Please see CONTRIBUTING for details.

Testing

Run the tests with:

Security

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

Contributors

@antonkomarev
Anton Komarev
@badrshs
badr aldeen shek salim
@rickmacgillis
Rick Mac Gillis
@AnsellC
AnsellC
@joearcher
Joe Archer
@Im-Fran
Francisco Solis
@jadamec
Jakub Adamec
@ilzrv
Ilia Lazarev
@ZeoKnight
ZeoKnight

Laravel Ban contributors list

Alternatives

License

🌟 Stargazers over time

Stargazers over time

About CyberCog

CyberCog is a Social Unity of enthusiasts. Research the best solutions in product & software development is our passion.

CyberCog


All versions of laravel-ban with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/database Version ^9.0|^10.0|^11.0
illuminate/events Version ^9.0|^10.0|^11.0
illuminate/support Version ^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 cybercog/laravel-ban contains the following files

Loading the files please wait ....