{"id":34010373,"url":"https://github.com/migratorydata/migratorydata-client-reactphp","last_synced_at":"2026-04-07T15:32:37.795Z","repository":{"id":62528440,"uuid":"277509274","full_name":"migratorydata/migratorydata-client-reactphp","owner":"migratorydata","description":"MigratoryData Client SDK for ReactPHP","archived":false,"fork":false,"pushed_at":"2025-04-08T20:38:38.000Z","size":105,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-15T00:23:24.610Z","etag":null,"topics":["migratorydata","reactphp"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/migratorydata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-07-06T10:16:16.000Z","updated_at":"2025-04-08T20:37:46.000Z","dependencies_parsed_at":"2025-04-08T21:36:34.637Z","dependency_job_id":null,"html_url":"https://github.com/migratorydata/migratorydata-client-reactphp","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/migratorydata/migratorydata-client-reactphp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/migratorydata%2Fmigratorydata-client-reactphp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/migratorydata%2Fmigratorydata-client-reactphp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/migratorydata%2Fmigratorydata-client-reactphp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/migratorydata%2Fmigratorydata-client-reactphp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/migratorydata","download_url":"https://codeload.github.com/migratorydata/migratorydata-client-reactphp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/migratorydata%2Fmigratorydata-client-reactphp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31518544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["migratorydata","reactphp"],"created_at":"2025-12-13T12:03:21.121Z","updated_at":"2026-04-07T15:32:37.775Z","avatar_url":"https://github.com/migratorydata.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MigratoryData Client for ReactPHP 5.x \u0026 6.x #\n\nBelow you can find a tutorial and usage example. For more information please refer to [MigratoryData Documentation 6.x](https://migratorydata.com/docs/client-api/reactphp/).\n\n## Usage ##\nInstall the MigratoryData client library **5.x** using composer (MigratoryData client version 5 can be used with MigratoryData Server 5.0.*):\n```bash\ncomposer require migratorydata/migratorydata-client-reactphp:5.*\n```\n\nInstall the MigratoryData client library **6.x** using composer (MigratoryData client version 6 can be used with the MigratoryData server 6.0.1 or later):\n```bash\ncomposer require migratorydata/migratorydata-client-reactphp:6.*\n```\n\nImport classes and define MigratoryData callback listener:\n\n```php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse MigratoryData\\Client\\MigratoryDataClient;\nuse MigratoryData\\Client\\MigratoryDataMessage;\nuse MigratoryData\\Client\\MigratoryDataListener;\n\nclass MyListener implements MigratoryDataListener\n{\n    public function onMessage($message)\n    {\n        echo \"Got message: \" . $message . \"\\n\";\n    }\n\n    public function onStatus($status, $info)\n    {\n        echo \"Got status: \" . $status . \" - \" . $info . \"\\n\";\n    }\n}\n```\n\nCreate the event loop:\n\n```php\n$loop = \\React\\EventLoop\\Factory::create();\n```\n\nCreate a MigratoryData client and attach the event loop:\n\n```php\n$client = new MigratoryDataClient(); \n$client-\u003esetLoop($loop);\n```\n\nInitialize and connect the MigratoryData client:\n\n```php    \n$client-\u003esetEntitlementToken(\"some-token\");\n$client-\u003esetServers(array(\"http://127.0.0.1:8800\"));\n\n$client-\u003esubscribe(array(\"/server/status\"));\n\n$client-\u003econnect();\n```\n \nPublish a message every second to MigratoryData server:\n \n```php\n$loop-\u003eaddPeriodicTimer(1, function () use ($client) {\n    try {\n        $client-\u003epublish(new MigratoryDataMessage(\"/server/status\", \"Msg \" . time(), \"closure-\" . time()));\n    } catch (MigratoryDataException $e) {\n        echo($e-\u003egetDetail());\n        echo($e-\u003egetCause());\n    }\n});\n```\n\nStart the event loop:\n\n```php\n$loop-\u003erun();\n```\n\n## Example client application ##\n\nCopy the code below to a file named `echo-time-client.php` and run it using the following command:\n\n```bash  \nphp echo-time-client.php\n```\n\nExample for PHP React Client API\n\nThe client application connects to the MigratoryData server deployed at `localhost:8800` subscribes and publishes a message every second on the subject `/server/status`.\n\nIf you don't have a MigratoryData server installed on your machine but there is docker installed you can run the following command to start MigratoryData server, otherwise you can download and install the latest version for your os from [here](https://migratorydata.com/downloads/migratorydata-6/).\n\n```bash\ndocker pull migratorydata/server:latest\ndocker run -d --name my_migratorydata -p 8800:8800 migratorydata/server:latest\n```\n\n\n```php\n\u003c?php\n\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse MigratoryData\\Client\\MigratoryDataClient;\nuse MigratoryData\\Client\\MigratoryDataException;\nuse MigratoryData\\Client\\MigratoryDataMessage;\nuse MigratoryData\\Client\\MigratoryDataListener;\n\nclass MyListener implements MigratoryDataListener\n{\n    public function onMessage($message)\n    {\n        echo \"Got message: \" . $message . \"\\n\";\n    }\n\n    public function onStatus($status, $info)\n    {\n        echo \"Got status: \" . $status . \" - \" . $info . \"\\n\";\n    }\n}\n\n$loop = \\React\\EventLoop\\Factory::create();\n\n$client = new MigratoryDataClient();\n$client-\u003esetEntitlementToken(\"some-token\");\n$client-\u003esetLoop($loop);\n$client-\u003esetListener(new MyListener());\n\ntry {\n    $client-\u003esetServers(array(\"http://127.0.0.1:8800\"));\n} catch (MigratoryDataException $e) {\n    echo($e-\u003egetDetail());\n    exit(1);\n}\n\n$client-\u003esubscribe(array(\"/server/status\"));\n\n$client-\u003econnect();\n\n$loop-\u003eaddPeriodicTimer(1, function () use ($client) {\n    try {\n        $client-\u003epublish(new MigratoryDataMessage(\"/server/status\", \"Msg \" . time(), \"closure-\" . time()));\n    } catch (MigratoryDataException $e) {\n        echo($e-\u003egetDetail());\n        echo($e-\u003egetCause());\n    }\n});\n\n\n$loop-\u003erun();\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmigratorydata%2Fmigratorydata-client-reactphp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmigratorydata%2Fmigratorydata-client-reactphp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmigratorydata%2Fmigratorydata-client-reactphp/lists"}