{"id":22397108,"url":"https://github.com/putyourlightson/datastar-php","last_synced_at":"2025-07-31T12:31:40.011Z","repository":{"id":257827271,"uuid":"872922235","full_name":"putyourlightson/datastar-php","owner":"putyourlightson","description":"A set of PHP helper classes for working with Datastar.","archived":false,"fork":false,"pushed_at":"2024-11-05T19:17:29.000Z","size":38,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2024-11-29T11:07:53.309Z","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/putyourlightson.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":"bencroker"}},"created_at":"2024-10-15T09:57:52.000Z","updated_at":"2024-11-05T19:17:28.000Z","dependencies_parsed_at":"2024-10-28T18:18:12.638Z","dependency_job_id":"ac9e4dbf-1474-40c8-a575-083a779a807a","html_url":"https://github.com/putyourlightson/datastar-php","commit_stats":null,"previous_names":["putyourlightson/datastar-php"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyourlightson%2Fdatastar-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyourlightson%2Fdatastar-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyourlightson%2Fdatastar-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyourlightson%2Fdatastar-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/putyourlightson","download_url":"https://codeload.github.com/putyourlightson/datastar-php/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228242556,"owners_count":17890481,"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":"2024-12-05T06:10:53.266Z","updated_at":"2024-12-05T06:10:53.889Z","avatar_url":"https://github.com/putyourlightson.png","language":"PHP","funding_links":["https://github.com/sponsors/bencroker"],"categories":[],"sub_categories":[],"readme":"# Datastar PHP\n\nA dependency-free set of PHP helper classes for working with [Datastar](https://data-star.dev/).\n\n## License\n\nThis plugin is licensed for free under the MIT License.\n\n## Requirements\n\nThis plugin requires Datastar 0.19.3 or later and PHP 8.0.0 or later.\n\n## Installation\n\nInstall using composer or download and require the classes manually.\n\n```shell\ncomposer require putyourlightson/datastar-php\n```\n\n## Usage\n\n### Datastar Event Class\n\n```php\nuse putyourlightson\\datastar\\events\\FragmentEvent;\nuse putyourlightson\\datastar\\events\\SignalEvent;\nuse putyourlightson\\datastar\\events\\DeleteEvent;\nuse putyourlightson\\datastar\\events\\RedirectEvent;\nuse putyourlightson\\datastar\\events\\ConsoleEvent;\n\n$event = new FragmentEvent();\n$event-\u003econtent = '\u003cdiv id=\"primary\"\u003eNew content\u003c/div\u003e';\n// Optional\n$event-\u003eid = 1;\n$event-\u003eselector = '#secondary';\n$event-\u003emerge = 'morph';\n$event-\u003esettle = 100;\n$event-\u003evt = 'false';\n\n$event = new SignalEvent();\n$event-\u003estore = '{foo: \"bar\"}';\n// Optional\n$event-\u003eid = 1;\n$event-\u003eonlyIfMissing = 'true';\n\n$event = new DeleteEvent();\n$event-\u003eselector = '#primary';\n// Optional\n$event-\u003eid = 1;\n\n$event = new RedirectEvent();\n$event-\u003econtent = '/new-url';\n// Optional\n$event-\u003eid = 1;\n\n$event = new ConsoleEvent();\n$event-\u003econtent = 'Hello world';\n// Optional\n$event-\u003eid = 1;\n$event-\u003emode = 'error';\n\n// Returns the output of a Datastar event.\n$output = $event-\u003egetOutput();\n```\n\n### Datastar Response Class\n\n```php\nuse putyourlightson\\datastar\\DatastarResponse;\n\n$response = new DatastarResponse();\n\n// Sends Datastar events to the browser.\n$response-\u003esendEvent($event1);\n$response-\u003esendEvent($event2);\n$response-\u003esendEvent($event3);\n\n// Ends the response and closes the connection.\n$response-\u003eend();\n```\n\n---\n\nCreated by [PutYourLightsOn](https://putyourlightson.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputyourlightson%2Fdatastar-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fputyourlightson%2Fdatastar-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputyourlightson%2Fdatastar-php/lists"}