Skip to content

Commit

Permalink
Update PHP SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Feb 2, 2025
1 parent 652fd1e commit 16161d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions sdk/php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ $sse->removeSignals(['foo', 'bar']);

// Executes JavaScript in the browser.
$sse->executeScript('console.log("Hello, world!")');

// Redirects the browser by setting the location to the provided URI.
$sse->location('/guide');
```

```php
Expand Down
2 changes: 1 addition & 1 deletion sdk/php/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "starfederation/datastar-php",
"description": "A PHP SDK for working with Datastar.",
"version": "1.0.0-beta.8",
"version": "1.0.0-beta.9",
"type": "library",
"license": "mit",
"require": {
Expand Down
4 changes: 2 additions & 2 deletions sdk/php/src/ServerSentEventGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public function executeScript(string $script, array $options = []): void
}

/**
* Redirects the browser to the provided URI.
* Redirects the browser by setting the location to the provided URI.
*/
public function redirect(string $uri, array $options = []): void
public function location(string $uri, array $options = []): void
{
$script = 'setTimeout(() => window.location = "' . $uri . '")';
$this->executeScript($script, $options);
Expand Down

0 comments on commit 16161d8

Please sign in to comment.