cfg = $config ? $config : [ 'host' => Env::get('redis.host') ?? '127.0.0.1', 'port' => Env::get('redis.port') ?? '6379', 'password' => Env::get('redis.password') ?? null, 'select' => Env::get('redis.select') ?? 0, 'timeout' => Env::get('redis.timeout') ?? 500, ]; $this->connect = new \Redis(); $this->connect->connect( $this->cfg['host'], $this->cfg['port'], $this->cfg['timeout'] ); $this->connect->auth($this->cfg['password']); $this->connect->select($this->cfg['select']); return $this->connect; } static function of($config = null) { return (new RedisClient($config = null))->connect; } }