Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattCast44 committed Aug 7, 2022
1 parent a8589da commit 87b2429
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Binary file modified .art/banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ $server = Server::new()->runInBackground();
$server->stop();
```

### Restarting the server

You can restart the server by calling the `restart` method on an instance of the server class. An example of why you might need to restart the server is detecting when your `.env` file is changed, you could restart the server and ensure the env vars are loaded.

```PHP
$server = Server::new()->runInBackground();

// do work

$server->restart();
```

## Contributing

#### Installation
Expand Down
11 changes: 11 additions & 0 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,17 @@ public function stop(): array|null
];
}

public function restart(): self
{
if ($this->isRunning()) {
$this->stop();
}

$this->process = $this->initProcess();

return $this;
}

public function runInBackground(): self
{
$this->process = $this->initProcess();
Expand Down

0 comments on commit 87b2429

Please sign in to comment.