{"id":26172051,"url":"https://github.com/oktopost/tattler-php","last_synced_at":"2026-01-23T20:01:36.666Z","repository":{"id":57030742,"uuid":"71076207","full_name":"Oktopost/Tattler-php","owner":"Oktopost","description":"PHP Tattler client","archived":false,"fork":false,"pushed_at":"2024-10-07T11:00:14.000Z","size":192,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-28T08:35:41.289Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Oktopost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-16T20:46:21.000Z","updated_at":"2024-10-07T11:00:18.000Z","dependencies_parsed_at":"2022-08-23T18:50:43.592Z","dependency_job_id":null,"html_url":"https://github.com/Oktopost/Tattler-php","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oktopost%2FTattler-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oktopost%2FTattler-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oktopost%2FTattler-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oktopost%2FTattler-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Oktopost","download_url":"https://codeload.github.com/Oktopost/Tattler-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248952344,"owners_count":21188427,"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":[],"created_at":"2025-03-11T19:53:03.051Z","updated_at":"2026-01-23T20:01:31.629Z","avatar_url":"https://github.com/Oktopost.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tattler PHP client\n\n[![Build Status](https://travis-ci.org/Oktopost/Tattler-php.svg)](https://travis-ci.org/Oktopost/Tattler-php)\n[![Coverage Status](https://coveralls.io/repos/github/Oktopost/Tattler-php/badge.svg?branch=master)](https://coveralls.io/github/Oktopost/Tattler-php?branch=master)\n[![License MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/Oktopost/Tattler-php/blob/master/LICENSE)\n\nSend async messages to your users using [Tattler](https://github.com/grohman/tattler)\n\n- [Simple example project](https://github.com/grohman/tattler-php-chat-example)\n\n## Installation\n\n```bash\n$ composer require oktopost/tattler-php\n```\nOr add to `composer.json`:\n\n```json\n\"require\": {\n    \"oktopost/tattler-php\": \"^1.0\"\n}\n```\nand then run `composer update`.\n\n## Setup\n\n```php\n$config = new TattlerConfig();\n$tattlerConfig-\u003efromArray([\n        'WsAddress'         =\u003e 'TATTLER_WEBSOCKET_ADDRESS',\n        'ApiAddress'        =\u003e 'TATTLER_API_ADDRESS',\n        'Namespace'         =\u003e 'YOUR APPLICATION_NAME',\n        'Secret'            =\u003e 'TATTLER_SECRET',\n        'TokenTTL'          =\u003e 'USER_TOKEN_TTL',\n        'DBConnector'       =\u003e new RedisConnector(),\n        'NetworkConnector'  =\u003e new CurlConnector()\n]);\n\n/** @var ITattlerModule::class $tattler */\n$tattler = Tattler::getInstance($tattlerConfig);\n```\n_note: for using redis db connector you need to install [predis](https://github.com/nrk/predis)_\n\n* TATTLER_WEBSOCKET_ADDRESS - websocket transport address e.g. ws://websocket.domain.tld:80 or wss://websocket.domain.tld:443\n* TATTLER_API_ADDRESS - api address e.g. http://websocket.domain.tld:80 or https://websocket.domain.tld:443\n* YOUR APPLICATION_NAME - namespace for your application. You can use same tattler server with multiple applications.\n* TATTLER_SECRET - same secret that was defined in tattler-server configuration\n* USER_TOKEN_TTL - time in seconds for users auth tokens used with tattler-server\n\nThen create TattlerController available from your website. See example in [DummyControllerExample](https://github.com/Oktopost/Tattler-php/blob/master/controller/DummyControllerExample.php)  \n_note: all methods from that controller should response with JSON body_\n\nWhen php configuration is done, include [js/tattler.min.js](js/tattler.min.js) to your html and initialize tattler\n```javascript\nwindow.tattler = TattlerFactory.create();\n```\n\n## Usage\n\nSetup listener in your js code\n```javascript\nwindow.tattler.addHandler('myMessage', 'globalNamespace', function(data){\n\talert(data.message);\n});\n```\n\nSend payload to all users from php\n```php\n/** var ITattlerMessage::class $message */\n$message = new TattlerMessage();\n$message-\u003esetHandler('myMessage')-\u003esetNamespace('globalNamespace')-\u003esetPayload(['message' =\u003e 'Hello world']]);\n\n$tattler-\u003emessage($message)-\u003ebroadcast()-\u003esay();\n```\n\nSee more docs in [docs/](docs/README.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktopost%2Ftattler-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foktopost%2Ftattler-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktopost%2Ftattler-php/lists"}