{"id":18926925,"url":"https://github.com/bedrockstreaming/redisbundle","last_synced_at":"2025-04-15T13:33:34.012Z","repository":{"id":14359969,"uuid":"17069721","full_name":"BedrockStreaming/RedisBundle","owner":"BedrockStreaming","description":"Symfony2 Bundle over predis","archived":false,"fork":false,"pushed_at":"2022-05-23T06:43:36.000Z","size":164,"stargazers_count":8,"open_issues_count":0,"forks_count":9,"subscribers_count":47,"default_branch":"master","last_synced_at":"2025-03-27T04:07:03.730Z","etag":null,"topics":["php","redis","symfony2-bundle"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BedrockStreaming.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2014-02-21T21:09:13.000Z","updated_at":"2022-11-16T09:29:57.000Z","dependencies_parsed_at":"2022-08-30T00:01:35.724Z","dependency_job_id":null,"html_url":"https://github.com/BedrockStreaming/RedisBundle","commit_stats":null,"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BedrockStreaming%2FRedisBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BedrockStreaming%2FRedisBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BedrockStreaming%2FRedisBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BedrockStreaming%2FRedisBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BedrockStreaming","download_url":"https://codeload.github.com/BedrockStreaming/RedisBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249080524,"owners_count":21209537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","redis","symfony2-bundle"],"created_at":"2024-11-08T11:17:33.012Z","updated_at":"2025-04-15T13:33:33.666Z","avatar_url":"https://github.com/BedrockStreaming.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RedisBundle\n\n[![Build Status](https://github.com/BedrockStreaming/RedisBundle/actions/workflows/ci.yml/badge.svg)](https://github.com/BedrockStreaming/RedisBundle/actions/workflows/ci.yml) [![Latest Stable Version](http://poser.pugx.org/m6web/redis-bundle/v)](https://packagist.org/packages/m6web/redis-bundle) [![Total Downloads](http://poser.pugx.org/m6web/redis-bundle/downloads)](https://packagist.org/packages/m6web/redis-bundle) [![License](http://poser.pugx.org/m6web/redis-bundle/license)](https://packagist.org/packages/m6web/redis-bundle) [![PHP Version Require](http://poser.pugx.org/m6web/redis-bundle/require/php)](https://packagist.org/packages/m6web/redis-bundle)\n\nsymfony Bundle on top of predis\n\nsee [predis/predis](https://github.com/predis/predis)\n\n## features\n\n* semantic configuration\n* sf event dispatcher integration\n* session handler with redis storage : ```M6Web\\Bundle\\RedisBundle\\Redis\\RedisSessionHandler```\n* redis adapter for guzzle cache : ```M6Web\\Bundle\\RedisBundle\\Guzzle\\RedisCacheAdapter```\n* dataCollector for sf2 web profiler toolbar\n\n\n## usage\n\n### configuration\n\nin ```config.yml``` for a simple cache service :\n\n```\nm6web_redis:\n    servers:\n        default:\n            host:   'localhost'\n            port: 6379\n            reconnect: 1\n    clients:\n        default:\n            servers:   [\"default\"]     # list of servers to use\n            prefix:    raoul\\          # prefix to use\n            timeout:   2               # timeout in second\n            read_write_timeout: 2      # read-write timeout in second\n```\n\nfor a multiple clients :\n\n```\nm6web_redis:\n    servers:\n        first:\n            host:   'localhost'\n            port: 6379\n            reconnect: 1\n        second:\n            host:   'xxxxxxxx'\n    clients:\n        default:\n            servers:   [\"first\"]     # list of servers to use\n            prefix: raoul\\           # prefix to use\n            timeout:   2             # timeout in second (float)\n            read_write_timeout: 1.2  # read write timeout in seconds (float)\n            compress: true           # compress/uncompress data sent/retrieved from redis using gzip, only method SET, SETEX, SETNX, GET, MGET and MSET are supported\n        sharded:\n            servers: [\"first\", \"second\"]\n            prefix: raaaoul\\\n            timeout:   1\n```\n\n```$this-\u003eget('m6web_redis')``` send the default client. ```this-\u003eget('m6web_redis.sharded')``` the sharded one.\n\n### list of options in servers configuration\n\n - *host*: IP address or hostname of Redis.\n - *port*: CP port on which Redis is listening to. Default value 6379\n - *database*: Database index (see the SELECT command).\n - *scheme*: Connection scheme, such as 'tcp' or 'unix'. Default value tcp\n - *async_connect*: Performs the connect() operation asynchronously. Default value false\n - *persistent*: Leaves the connection open after a GC collection. Default value false\n - *timeout*:  Timeout for the connect() operation. Default value 10\n - *read_write_timeout*: Timeout for read() and write() operations\n - *reconnect*: Number of reconnection attempt if a redis command fail, only for tcp\n\n```\nm6web_redis:\n    servers:\n        server1:\n            host:   'localhost'\n            port: 6379\n\n```\n\n### server configuration via wildcard\n\n```\nm6web_redis:\n    servers:\n        server1:\n            host:   'localhost'\n            port: 6379\n        server2:\n            host:   'xxxxxxxx'\n    clients:\n        default:\n            servers:   [\"server*\"]     # all servers matching server*\n            prefix: raoul\\\n            timeout:   2\n```\n\n\n### event dispatcher\n\nThe event ```M6Web\\Bundle\\RedisBundle\\EventDispatcher\\RedisEvent``` is automaticly dispatched when a command is executed. Events are fired with the ```redis.command``` label.\n\nYou can customize the event name through the client configuration : \n \n ```yml\n m6web_redis:\n    clients:\n        default:\n            eventname: myEventName\n```            \n\n### session handler\n\n```\n# app/config/config.yml\nframework:\n  session:\n    # ...\n    handler_id: session.handler.redis\n\nm6web_redis:\n  servers:\n    first:\n      ip: 'localhost'\n      port: 6379\n  clients:\n    sessions:\n      servers: [\"first\"]\n      prefix: sessions\\\n      timeout: 1\n\nservices:\n  session.handler.redis:\n    class: M6Web\\Bundle\\RedisBundle\\Redis\\RedisSessionHandler\n    public:    false\n    arguments:\n      - '@m6web_redis.sessions'\n      - 3600\n```\n\n### dataCollector\n\nDatacollector is available when the Symfony profiler is enabled. The collector allow you to see the following Redis data:\n\n - Command name\n - Execution time\n - Command arguments\n\n### overwriting base class\n\n```\nm6web_redis:\n    clients:\n        default:\n            servers: [\"first\"]\n            type: [\"db\"]\n            timeout: 0.5\n            class: \\MyCompany\\Redis\n```\n\n#### guzzle redis cache adapter\n\n\n```yml\nm6web_redis:\n  clients:\n    guzzlehttp:\n      servers: [\"first\"]\n      prefix: GuzzleHttp\\\n      class: M6Web\\Bundle\\RedisBundle\\CacheAdapters\\M6WebGuzzleHttp\n      timeout: 1\n```\n\n## Launch Unit Tests\n\n```shell\nbin/atoum\n```\n\n## Launch php cs\n\n```shell\n    make cs-ci\n    make cs-fix\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbedrockstreaming%2Fredisbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbedrockstreaming%2Fredisbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbedrockstreaming%2Fredisbundle/lists"}