A simple package to iterate over Redis data without having to write out the manual looping logic every time.
Note: So far, this is just an idea for a package I've put together. It's not production ready
You can install the package via composer:
composer require jhavenz/laravel-redis-scanner
You can publish the config file with:
php artisan vendor:publish --tag="laravel-redis-scanner-config"
This is the contents of the published config file:
return [
'connection' => env('REDIS_SCANNER_CONNECTION', 'default'),
];
use Jhavenz\LaravelRedisScanner\Facades\RedisScanner;
use Jhavenz\LaravelRedisScanner\ScannedValue;
// Scan a redis pattern and match the results
$users = collect(RedisScanner::scan(pattern: 'users:*', count: 100))
->map(fn(ScannedValue $s) => $s->redisValue());
composer test
The MIT License (MIT). Please see License File for more information.