Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Bloker Block

Bloker Block Laravel Package

adsazad/bloker-block

Laravel package for managing and blocking unwanted requests or users, with simple configuration and middleware-style integration to enforce access rules across routes. Helps reduce abuse and control traffic with customizable blocking logic.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Bloker Block
How do I install adsazad/bloker-block in a Laravel project?
Run `composer require adsazad/bloker-block` in your project directory. The package follows Laravel’s standard Composer structure, so no additional setup is required beyond publishing the config file if needed. Check the package’s `composer.json` for Laravel version requirements to ensure compatibility.
Does this package support Laravel 10 and PHP 8.1+?
The package likely targets older Laravel versions (check its `composer.json` for exact requirements). If it doesn’t explicitly support Laravel 10 or PHP 8.1+, you may need to fork it or use a different package like `spatie/laravel-blocklist` for modern compatibility. Always verify the package’s documentation or GitHub issues for updates.
Can I block users by email, username, or other custom identifiers?
Yes, the package is designed to block entities by any identifier (users, IPs, emails, etc.). You’ll configure the blocklist to target specific fields or logic via middleware or helper methods. The README should outline how to define custom block rules if the default options don’t fit your needs.
How do I integrate this with Laravel’s middleware stack?
Use the package’s provided middleware (e.g., `BlockMiddleware`) in your `app/Http/Kernel.php` under the `$middleware` or `$middlewareGroups` array. Place it early in the stack to deny requests before they reach routes. The package likely includes a helper like `Block::isBlocked($identifier)` for manual checks in controllers.
What HTTP status code and response does it return for blocked requests?
The package allows customization of status codes (default is likely 403 Forbidden) and response messages. Configure these in the published config file or via middleware options. You can also override the response entirely by extending the package’s logic or using Laravel’s `abort()` method in your middleware.
Is there a way to temporarily block users (e.g., for 24 hours)?
The package may not natively support time-based blocking, but you can implement this by storing timestamps in the blocklist (e.g., a `blocked_until` column) and checking expiration in middleware. Alternatively, combine it with Laravel’s caching (e.g., `Cache::put('blocked:user_id', true, 86400)`) for temporary bans.
How do I manage the blocklist (add/remove blocked entries)?
The package likely provides Eloquent models or database migrations for the blocklist. Use Laravel’s standard CRUD methods (e.g., `Block::create()`) or build admin routes to manage entries. If no built-in admin interface exists, you’ll need to create one using Laravel’s controllers and Blade views or a package like `orchid/platform`.
Are there alternatives to adsazad/bloker-block for Laravel?
Yes, consider `spatie/laravel-blocklist` for a more maintained solution, or `laravel/throttle` for rate-limiting. For IP-based blocking, `spatie/laravel-geo-blocker` is another option. Evaluate alternatives based on features like ease of use, Laravel version support, and community activity. Always check GitHub stars and recent commits for reliability.
Does this package work with Laravel’s caching system?
The package may not integrate directly with Laravel’s caching, but you can optimize it by caching blocklist queries (e.g., `Cache::remember('blocked_ips', 60, fn() => Block::where('type', 'ip')->get())`). This reduces database load for frequent checks. Test caching in staging to avoid stale data issues.
How do I test blocking logic in my Laravel application?
Mock the middleware or helper methods in your tests using Laravel’s `actingAs()` or `partialMock()` for middleware. For example, test a blocked user by injecting a fake blocklist entry or overriding the `Block::isBlocked()` method. Use PHPUnit assertions to verify HTTP responses (e.g., `assertEquals(403, $response->status())`).
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity