repat / spatie-crawler-redis
Redis CrawlQueue for spatie/crawler
Installs: 9 722
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 2
Open Issues: 2
Requires
- php: >=7.1
- predis/predis: ^1.1
- spatie/crawler: >=4.6
Requires (Dev)
- larapack/dd: ^1.1
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-11-08 01:02:12 UTC
README
spatie-crawler-redis is an alternative CrawlerQueue implementing the Spatie\Crawler\CrawlQueue\CrawlQueue
interface using Redis Hashes.
Installation
$ composer require repat/spatie-crawler-redis
Example
Create a Predis\Client
beforehand if you need options, such as selecting a database. If you don't pass a client, a new one without options will be used. Predis assumes 127.0.0.1
, 6379
and 0
as default host, port and database. You can also pass a custom prefix, otherwise uniqid()
will be used.
use Repat\CrawlQueue\RedisCrawlQueue; // see https://github.com/nrk/predis for options $options = [ 'database' => 7, ]; $prefix = uniqid() . ':'; // same as passing no prefix $redisClient = new \Predis\Client($options); // ... ->setCrawlQueue(new RedisCrawlQueue($redisClient, $prefix)) // uses new \Predis\Client without options ->setCrawlQueue(new RedisCrawlQueue())
TODO
phpredis
support
Testing
Thanks spatie for the tests. These are the instructions:
To run the tests you'll have to start the included node based server first in a separate terminal window.
cd tests/server
npm install
./start_server.sh
With the server running, you can start testing.
vendor/bin/phpunit
License
- MIT, see LICENSE
Version
- Version 0.2.1
Contact
repat
- Homepage: repat.de
- e-mail: repat@repat.de
- Twitter: @repat123