Skip to content

Commit

Permalink
Merge pull request #576 from rosamarsky/remove-phpredis-dependency-fr…
Browse files Browse the repository at this point in the history
…om-composer

Removed predis from composer.json
  • Loading branch information
makasim authored Oct 22, 2018
2 parents 20ee1da + cd4bdc1 commit e635bf5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"stomp-php/stomp-php": "^4",
"php-http/guzzle6-adapter": "^1.1",
"php-http/client-common": "^1.7@dev",
"richardfullmer/rabbitmq-management-api": "^2.0"
"richardfullmer/rabbitmq-management-api": "^2.0",
"predis/predis": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^5.5",
Expand All @@ -48,7 +49,6 @@
"empi89/php-amqp-stubs": "*@dev",
"doctrine/doctrine-bundle": "~1.2",
"kwn/php-rdkafka-stubs": "^1.0.2",
"predis/predis": "^1.1",
"friendsofphp/php-cs-fixer": "^2"
},
"autoload": {
Expand Down
12 changes: 9 additions & 3 deletions pkg/redis/RedisConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,17 @@ public function createContext(): Context
private function createRedis(): Redis
{
if (false == $this->redis) {
if (in_array('predis', $this->config['scheme_extensions'], true)) {
$this->redis = new PRedis($this->config);
} elseif (in_array('phpredis', $this->config['scheme_extensions'], true)) {
if (in_array('phpredis', $this->config['scheme_extensions'], true)) {
if (false == class_exists(\Redis::class)) {
throw new \LogicException('You must install the redis extension to use phpredis');
}

$this->redis = new PhpRedis($this->config);
} else {
if (false == class_exists(\Predis\Client::class)) {
throw new \LogicException('The package "predis/predis" must be installed. Please run "composer req predis/predis:^1.1" to install it');
}

$this->redis = new PRedis($this->config);
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/redis/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"require": {
"php": "^7.1.3",
"queue-interop/queue-interop": "0.7.x-dev",
"enqueue/dsn": "0.9.x-dev",
"predis/predis": "^1.1"
"enqueue/dsn": "0.9.x-dev"
},
"require-dev": {
"phpunit/phpunit": "~5.4.0",
Expand Down

0 comments on commit e635bf5

Please sign in to comment.