Skip to content

Commit e635bf5

Browse files
authored
Merge pull request #576 from rosamarsky/remove-phpredis-dependency-from-composer
Removed predis from composer.json
2 parents 20ee1da + cd4bdc1 commit e635bf5

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"stomp-php/stomp-php": "^4",
3030
"php-http/guzzle6-adapter": "^1.1",
3131
"php-http/client-common": "^1.7@dev",
32-
"richardfullmer/rabbitmq-management-api": "^2.0"
32+
"richardfullmer/rabbitmq-management-api": "^2.0",
33+
"predis/predis": "^1.1"
3334
},
3435
"require-dev": {
3536
"phpunit/phpunit": "^5.5",
@@ -48,7 +49,6 @@
4849
"empi89/php-amqp-stubs": "*@dev",
4950
"doctrine/doctrine-bundle": "~1.2",
5051
"kwn/php-rdkafka-stubs": "^1.0.2",
51-
"predis/predis": "^1.1",
5252
"friendsofphp/php-cs-fixer": "^2"
5353
},
5454
"autoload": {

pkg/redis/RedisConnectionFactory.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,17 @@ public function createContext(): Context
9494
private function createRedis(): Redis
9595
{
9696
if (false == $this->redis) {
97-
if (in_array('predis', $this->config['scheme_extensions'], true)) {
98-
$this->redis = new PRedis($this->config);
99-
} elseif (in_array('phpredis', $this->config['scheme_extensions'], true)) {
97+
if (in_array('phpredis', $this->config['scheme_extensions'], true)) {
98+
if (false == class_exists(\Redis::class)) {
99+
throw new \LogicException('You must install the redis extension to use phpredis');
100+
}
101+
100102
$this->redis = new PhpRedis($this->config);
101103
} else {
104+
if (false == class_exists(\Predis\Client::class)) {
105+
throw new \LogicException('The package "predis/predis" must be installed. Please run "composer req predis/predis:^1.1" to install it');
106+
}
107+
102108
$this->redis = new PRedis($this->config);
103109
}
104110

pkg/redis/composer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"require": {
99
"php": "^7.1.3",
1010
"queue-interop/queue-interop": "0.7.x-dev",
11-
"enqueue/dsn": "0.9.x-dev",
12-
"predis/predis": "^1.1"
11+
"enqueue/dsn": "0.9.x-dev"
1312
},
1413
"require-dev": {
1514
"phpunit/phpunit": "~5.4.0",

0 commit comments

Comments
 (0)