{"id":18356281,"url":"https://github.com/daalvand/pub-sub","last_synced_at":"2026-05-09T15:05:45.284Z","repository":{"id":46808666,"uuid":"409910216","full_name":"daalvand/pub-sub","owner":"daalvand","description":"This package used to publish and subscribe with Regis or Kafka","archived":false,"fork":false,"pushed_at":"2021-09-24T10:06:18.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T17:43:11.765Z","etag":null,"topics":["kafka","laravel","pub-sub","publish-subscribe","pubsub","redis"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daalvand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-24T09:40:11.000Z","updated_at":"2023-03-17T12:44:37.000Z","dependencies_parsed_at":"2022-09-22T14:24:49.116Z","dependency_job_id":null,"html_url":"https://github.com/daalvand/pub-sub","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daalvand%2Fpub-sub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daalvand%2Fpub-sub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daalvand%2Fpub-sub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daalvand%2Fpub-sub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daalvand","download_url":"https://codeload.github.com/daalvand/pub-sub/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142586,"owners_count":21054665,"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":["kafka","laravel","pub-sub","publish-subscribe","pubsub","redis"],"created_at":"2024-11-05T22:09:33.920Z","updated_at":"2026-05-09T15:05:40.240Z","avatar_url":"https://github.com/daalvand.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PUB SUB\n\n* This package used to publish and subscribe with Regis or Kafka\n\n# installation\n## install package\nrun `composer require daalvand/pubsub`\n\n### publish provider\n\n#### Laravel\n* `php artisan vendor:publish --provider=\"Daalvand\\PubSub\\PubSubServiceProvider\"`\n\n#### Lumen\n* Add the service provider to `bootstrap/app.php` file:\n```php\n\u003c?php\n//...\n/** @var App $app */\n$app-\u003eregister(Daalvand\\PubSub\\PubSubServiceProvider::class);\n```\n\nCopy the config files from `/vendor/daalvand/pubsub/src/config` to `config` directory. Then configure it in  `/bootstrap/app.php` file:\n\n```php\n\u003c?php\n/** @var App $app */\n$app-\u003econfigure(\"pub-sub\");\n```\n\n## USAGE\n\n#### Publisher\n\n```php\n\n\nuse Daalvand\\PubSub\\Facades\\Publisher;\n\nPublisher::publish('channel_name', $data);\n\n```\n\n#### Subscriber\n\n```php\n\nuse Daalvand\\PubSub\\Facades\\Subscriber;\nuse Daalvand\\PubSub\\Message;\n\nSubscriber::subscribe(['channel_one', 'channel_two'], function (Message $message) {\n    switch ($message-\u003egetType()) {\n    case 'channel_one':\n        //a\n        break;\n    case 'channel_two':\n        //b\n        break;\n    }\n}, 'user');\n\n```\n**NOTE**\n\nNotice that the real channel name is like below:\n`{microservice_name}_{channel_name}_{environment}`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaalvand%2Fpub-sub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaalvand%2Fpub-sub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaalvand%2Fpub-sub/lists"}