trowski
Repos
31
Followers
183
Following
41

A non-blocking concurrency framework for PHP applications. 🐘

3891
229

The PHP Interpreter

C
35228
7168

A non-blocking HTTP application server for PHP based on Amp.

1226
91

Parallel processing for PHP based on Amp.

657
54

WebSocket component for PHP based on the Amp HTTP server.

91
13

Async Postgres client for PHP based on Amp.

73
17

Events

create branch
trowski create branch 2.x-pairs-regex
Created at 4 hours ago

Add ForwardedForMiddleware

Created at 5 hours ago
create branch
trowski create branch 3.x-forwarded
Created at 5 hours ago
delete branch
trowski delete branch 3.x-logging
Created at 1 day ago
delete branch
trowski delete branch temporary-branch-with-serverobserver
Created at 1 day ago
delete branch
trowski delete branch queries
Created at 1 day ago

Add create prefix to static constructors

Created at 1 day ago

More docs

Created at 2 days ago
RFC: Introduce an interface for `Session` (v3 only)

We never use Interface in any interface names. We can still have BC breaks in the beta, especially for something as easy to fix as a name. So definitely Session as the interface name, and… I dunno for the implementation, I'm terrible at naming things.

Created at 2 days ago

On second thought, static constructors

Single log message for request and response

Created at 3 days ago
create tag
trowski create tag v5.0.0-beta.9
Created at 4 days ago

Move header folding test to expected failures

Split SocketHttpServer

Created at 4 days ago

Fix test issues revealed after updating amphp/http-server

Created at 5 days ago

Update for "raw" to "pairs" rename

Created at 5 days ago

Update for amphp/http beta 2

Fix Psalm issues

Created at 5 days ago
create tag
trowski create tag v2.0.0-beta.2
Created at 5 days ago
issue comment
unexpected segmentation fault

More specifically, 8.1.15-16 and 8.2.2-3 have a GC bug that will segfault in a fiber, which was fixed in 8.1.17 and 8.2.4.

I was considering throwing an exception or triggering an error in the Revolt event loop if the affected versions are used since the application will segfault eventually.

Created at 5 days ago
push

Change "raw" to "pairs"

Created at 5 days ago
create tag
trowski create tag v1.4.3
Created at 5 days ago

Allow calling Context::join() immediately

Created at 5 days ago
delete branch
trowski delete branch context-backtrace
Created at 5 days ago

Include context backtrace in message (#168)

Created at 5 days ago
pull request closed
Include context backtrace in message

PHP does not call __toString() on a previous exception, so our decision to wrap ContextPanicError in a ContextException had the unfortunate side-effect of removing the context trace from the output of an uncaught exception.

There's a couple ways we can approach this. This PR puts the trace as a string into the message. This has the side-effect of needing to create a stack-trace string for uncaught exceptions from Tasks, but is mostly negligible I'd think.

Another approach would be to use reflection to set the $trace property of the parent exception, forcing the child trace to be the trace of the ContextPanicError object.

(new \ReflectionProperty(parent::class, 'trace'))->setValue($this, $originalTrace);
Created at 5 days ago
issue comment
Can't get CancelledException ends the task properly without killing the child process

A closure provided to a Cancellation should not throw. These functions are executed within the event loop, not within the context where they are defined. The Cancellation documentation doesn't make this clear, so I apologize for the confusion.

The cancellation subscriber should instead trigger some action that would then stop the operation and potentially throw from the original context, such as failing a deferred.

$deferred = new DeferredFuture();
$cancellation->subscribe(fn ($e) => $deferred->error($e));
return $deferred->await();

Many APIs can accept an optional Cancellation, such as HttpClient::request() in amphp/http-client, eliminating the need to set up a subscriber yourself. delay() is another such function. Your example could be simplified to:

class Job implements Task {
 public function run(Channel $channel, Cancellation $cancellation): bool {
  delay(2, cancellation: $cancellation); // fake work, longer than the timeout
  return true;
 }
}
Created at 6 days ago
create tag
trowski create tag v1.1.1
Created at 6 days ago