{"id":13827816,"url":"https://github.com/pupper/pupper-react","last_synced_at":"2025-07-09T05:30:34.230Z","repository":{"id":57138458,"uuid":"107287289","full_name":"pupper/pupper-react","owner":"pupper","description":"React components for Pupper","archived":true,"fork":false,"pushed_at":"2020-07-29T06:11:27.000Z","size":1970,"stargazers_count":13,"open_issues_count":6,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-26T02:07:08.526Z","etag":null,"topics":["php","pupper","react","websockets"],"latest_commit_sha":null,"homepage":"https://pupper.github.io/pupper-react","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pupper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-17T15:23:13.000Z","updated_at":"2023-01-28T13:18:45.000Z","dependencies_parsed_at":"2022-09-02T19:22:55.991Z","dependency_job_id":null,"html_url":"https://github.com/pupper/pupper-react","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/pupper/pupper-react","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pupper%2Fpupper-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pupper%2Fpupper-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pupper%2Fpupper-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pupper%2Fpupper-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pupper","download_url":"https://codeload.github.com/pupper/pupper-react/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pupper%2Fpupper-react/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262347805,"owners_count":23296942,"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","pupper","react","websockets"],"created_at":"2024-08-04T09:02:12.592Z","updated_at":"2025-07-09T05:30:33.949Z","avatar_url":"https://github.com/pupper.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"![d005d89e-ff25-4450-9119-aa56ff0d8949](https://user-images.githubusercontent.com/3274103/31629229-4859fe88-b2b3-11e7-85fb-66c35710f607.png)\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/50309dd39f0f4c4cb160f779050b710a)](https://www.codacy.com/app/bouiboui/pupper-react?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=pupper/pupper-react\u0026utm_campaign=badger)\n\nPupper stands for \"PHP Plus React\" (PPR \u003e Pupper). The goal is to make a Framework that takes the best of both technologies and makes them communicate bi-directionnaly.\n\n[See pupper on Github for more information](https://github.com/bouiboui/pupper/tree/master/app)\n\n## API\n### SocketProvider\n\n`SocketProvider` takes a WebSocket as a prop and hydrates it to its child components.\n\nIt can automatically bind them by using the `bindTo` prop, that can be overwritten.\n\n```jsx\nconst globalSocket = new WebSocket('ws://127.0.0.1/ws');\n\n\u003cSocketProvider socket={globalSocket} bindTo='customEvent'\u003e\n    \n    {/* becomes \u003cCustomComponent socket={globalSocket} bindTo='customEvent'/\u003e */}\n    \u003cCustomComponent/\u003e\n       \n    {/* becomes \u003cOtherComponent socket={globalSocket} bindTo='otherEvent'/\u003e */}\n    \u003cCustomComponent bindTo='otherEvent' /\u003e\n    \n\u003c/SocketProvider\u003e\n```\n\n### withSocket\n\n`withSocket` ables a component to be provided by `SocketProvider`.\n```jsx\nexport default withSocket(MyComponent)\n```\n---\n\n### EventListener\n\n`EventListener` is the Component you want to extend whenever you want to **receive** updates for an event. \n\nOverwrite its `onData` method to define what to do with the value.\n\n```jsx\nclass CustomerLogger extends EventListener {\n    onData(value) {\n        console.log('Customer has logged', value);\n    }\n}\n\n// Usage\n\u003cCustomerLogger bindTo='customerHasLogged'/\u003e\n```\n\n### EventDispatcher\n\n`EventDispatcher` is the Component you want to extend whenever you want to **send** event updates. \n\nInvoke its `onSubmit` method to send a new event with its `toSubmit` prop value.\n\n```jsx\nclass LoginButton extends EventDispatcher {\n    render() {\n        return \u003cbutton onClick={this.onSubmit}\u003eSubmit\u003c/button\u003e\n    }\n}\n\n// Usage\n\u003cLoginButton toSubmit={this.state.customerId} bindTo='customerHasLogged'/\u003e\n```\n\n## Credits\n\n- [bouiboui][link-author]\n- [All Contributors][link-contributors]\n\n## License\n\nUnlicense. Please see [License File](LICENSE.md) for more information.\n\n[ico-license]: https://img.shields.io/badge/license-Unlicense-brightgreen.svg?style=flat-square\n\n[link-author]: https://github.com/bouiboui\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpupper%2Fpupper-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpupper%2Fpupper-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpupper%2Fpupper-react/lists"}