Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Parallel Laravel Package

amphp/parallel

True parallel processing for PHP with Amp: run blocking tasks in worker processes or threads without blocking the event loop and without extra extensions. Includes non-blocking concurrency tools and a worker pool API for submitting tasks and collecting results.

View on GitHub
Deep Wiki
Context7
v2.3.3

What's Changed

New Contributors

Full Changelog: https://github.com/amphp/parallel/compare/v2.3.2...v2.3.3

v2.3.2

What's Changed

New Contributors

Full Changelog: https://github.com/amphp/parallel/compare/v2.3.1...v2.3.2

v1.4.4

What's Changed

  • Fixed PHP 8.4 deprecations in the 1.x release series.

Please upgrade to 2.x if you can.

Full Changelog: https://github.com/amphp/parallel/compare/v1.4.3...v1.4.4

v2.3.1

What's Changed

New Contributors

Full Changelog: https://github.com/amphp/parallel/compare/v2.3.0...v2.3.1

v2.3.0

What's Changed

  • Added LimitedWorkerPool extending WorkerPool in https://github.com/amphp/parallel/pull/205.
  • Added DelegatingWorkerPool implementing LimitedWorkerPool, which will only allow a limited number of workers to be pulled from a delegate WorkerPool instance.
  • ContextWorkerPool also now implements LimitedWorkerPool, as this pool implementation was already spawned a limited number of workers.

Full Changelog: https://github.com/amphp/parallel/compare/v2.2.9...v2.3.0

v2.2.9

What's Changed

  • Fixed a race condition if outstanding accept calls were pending when closing SocketIpcHub.
  • Removed use of error-suppression operator to avoid warnings from mis-configured error handlers (#200).

Full Changelog: https://github.com/amphp/parallel/compare/v2.2.8...v2.2.9

v2.2.8

What's Changed

  • Fixed race condition on concurrent IPC connect calls (#199)Thank you @Nadyita for reporting and debugging this issue.
v2.2.7

What's Changed

Full Changelog: https://github.com/amphp/parallel/compare/v2.2.6...v2.2.7

v2.2.6

What's Changed

  • Fixed hang during shutdown if a process or thread context has not ended (fixes amphp/file#75).

Full Changelog: https://github.com/amphp/parallel/compare/v2.2.5...v2.2.6

v2.2.5

What's Changed

  • Fixed potential hang during shutdown if the process context returned from DefaultContextFactory was not shutdown.

Full Changelog: https://github.com/amphp/parallel/compare/v2.2.4...v2.2.5

v2.2.4

What's Changed

  • Fixed SocketIpcHub not removing the temporary socket file if the object was not explicitly closed before destruction (fixes #183).
  • Add previous exception message when fail to start process by @thgs in https://github.com/amphp/parallel/pull/192

New Contributors

Full Changelog: https://github.com/amphp/parallel/compare/v2.2.3...v2.2.4

v2.2.3

What's Changed

  • Fixed accepting a socket with SocketIpcHub::accept() after cancelling a prior accept operation.

Full Changelog: https://github.com/amphp/parallel/compare/v2.2.2...v2.2.3

v2.2.2
  • Fixed potential hang of a ProcessContext created by DefaultContextFactory if output buffers fill by piping STDOUT and STDERR to the same pipes on the parent process. This also provides parity with the default behavior of ThreadContext.
v2.2.1
  • Fixed simultaneous creation of workers in ContextWorkerPool.
  • Fixed the IPC pipe in ProcessContext closing immediately after the process exited which potentially prevented reading the last sent data.
v2.2.0
  • Context::join() may now be called at any time instead of needing to wait until the context has sent or received all data on its channel.
  • The backtrace of exceptions thrown in child processes/threads is now included in the message of ContextPanicError, TaskFailureException, and TaskFailureError to avoid the backtrace being hidden from users due to PHP not calling Throwable::__toString() on previous exceptions. (#168)
  • Fixed assigning workers to waiting tasks submitted to ContextWorkerPool. Previously, in some circumstances two tasks may have been assigned to a single worker if both were enqueued when the worker finished a prior task. (#177)
v1.4.3
  • Better fix for class alias being redeclared when opcache preloading is enabled (#159)
v2.1.0
  • ContextPanicError is no longer thrown from receive(), send(), and join() in Context. Only ContextException can now be thrown from these methods. A ContextPanicError will be wrapped instead in a ContextException.
v2.0.0

Stable release compatible with AMPHP v3 and fibers! 🎉

As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.

All classes related to ext-pthreads have been removed as this extension does not have releases on PHP 8.x.

Classes in the Amp\Parallel\Sync namespace have been moved to amphp/sync.

Context

  • Process renamed to ProcessContext
  • Parallel renamed to ThreadContext
  • Context::isRunning() and Context::kill() replaced by Context::isClosed() and Context::close()
  • Context related functions:
    • runstartContext
    • factorycontextFactory
    • create has been removed, use startContext
  • Xdebug ini settings are forwarded to processes created by ProcessContext (including workers executing tasks), allowing step debugging through IDEs such as PhpStorm.
  • Improved UX of uncaught exceptions in child processes and task runs. The full stack trace in the context is displayed when converting the ContextPanicError or TaskFailureThrowable to a string, i.e., when the exception is uncaught in the parent and is written to STDERR
  • Added an optional Cancellation argument to ContextFactory::start()

Worker

  • Pool renamed to WorkerPool and DefaultPool renamed to ContextWorkerPool
  • TaskWorker has been marked as internal. Use a WorkerFactory to create Worker instances or use WorkerPool::getWorker() to get a worker from a pool
  • TaskRunner has been removed
  • Removed deprecated TaskException and TaskError
  • Worker::enqueue() renamed to Worker::submit(), which now returns an Execution object
    • Execution::getFuture() returns a future that resolves to the eventual return value of the Task
    • Execution::await() awaits the result of the Task, it is a shortcut to calling Execution::getFuture()->await()
    • Execution::getChannel() returns a Channel that can be used to communicate with the Channel provided to Task::run()
    • The arguments to Task::run() have changed to Channel and Cancellation

IpcHub

Inter-process communication is now exposed as part of the public API for potential use outside of the context and worker components.

v1.4.2
  • Fixed class alias being redeclared when opcache preloading is enabled (#154)
v2.0.0-beta.5
  • Improved UX of uncaught exceptions in child processes and task runs. The full stack trace in the context is displayed when converting the ContextPanicError or TaskFailureThrowable to a string, i.e., when the exception is uncaught in the parent and is written to STDERR
  • Xdebug ini settings are forwarded to processes created by ProcessContext (including workers executing tasks), allowing step debugging through IDEs such as PhpStorm.
  • Added an optional Cancellation argument to ProcessContext::start() and ContextFactory::start()
  • Fix signals terminating child processes if a handler was not created in the child
  • Updated for compatibility of 2.0 of amphp/socket
v2.0.0-beta.4
  • Added compatibility with Revolt v1.x
v2.0.0-beta.3

Update for Closable interface being moved from amphp/byte-stream to amphp/amp.

  • Amp\Parallel\Ipc\IpcHub now extends Amp\Closable instead of Amp\ByteStream\Closable.
  • Amp\Parallel\Process\Context gained an onClose method because Amp\Sync\Channel now extends Amp\Closable.
v2.0.0-beta.2
  • PHP 8.1 is now required.
  • IpcHub now extends Closable, adding an onClose() method.
v2.0.0-beta.1

Initial release compatible with AMPHP v3.

All classes related to ext-pthreads and ext-parallel have been removed as both extension do not have releases on PHP 8.x.

Classes in the Amp\Parallel\Sync namespace have been moved to amphp/sync.

Context

  • Process renamed to ProcessContext
  • Context::isRunning() and Context::kill() replaced by Context::isClosed() and Context::close()
  • Context related functions:
    • runstartContext
    • factorycontextFactory
    • create has been removed, use startContext

Worker

  • Pool renamed to WorkerPool and DefaultPool renamed to DefaultWorkerPool
  • TaskWorker renamed to DefaultWorker
  • TaskRunner has been moved to a function, runTasks
  • Removed deprecated TaskException and TaskError
  • Worker::enqueue() renamed to Worker::submit(), which now returns an Execution object
    • Execution::getResult() returns a future that resolves to the eventual return value of the Task
    • Execution::getChannel() returns a Channel that can be used to communicate with the Channel provided to Task::run()
    • The arguments to Task::run() have changed to Channel, Cache, and Cancellation
v1.4.1

What's Changed

New Contributors

Full Changelog: https://github.com/amphp/parallel/compare/v1.4.0...v1.4.1

v1.4.0
  • Added a new parameter accepting an Amp\Serialization\Serializer instance to the constructor of ChannelledStream, ChannelledSocket, and SharedMemoryParcel using the new amphp/serialization library. This new parameter allows the serialization algorithm to be customized (e.g., using JSON or allowing only strings instead of only PHP built-in serializer).
  • Fixed serializing exception stack trace if arguments were disabled. (#109)
  • Fixed the return value of Worker::isRunning() when a worker crashes. (#110)
  • When a worker crashes, a warning is now triggered. This warning may be logged for debugging failing workers. (#110)
  • Fixed error when unwrapping shared memory when the original is moved during the read. (#100)
  • Improved exception message when a Task return value is not serializable. (#103)
  • Updated shared memory message errors. (#100)
  • Improved launching many processes/workers on certain systems. (#112)
v1.3.0
  • PHP 7.1+ now required.
  • Improved cleanup of temporary files for IPC server (#82).
  • Improved error message when a callable cannot be autoloaded (#83).
  • Added ContextPanicError which extends the now-deprecated PanicError. This class contains improved methods for retrieving the original class name, exception message, code, and flattened stack trace of exceptions thrown in the child process or thread.
  • Added TaskFailureException and TaskFailureError, extending TaskException and TaskError respectively, which are now deprecated, to improve error reporting from workers. These classes are similar to ContextPanicError with improvements to retrieving information about the original exception.
  • Added ContextFactory and functions Amp\Parallel\Context\create() and Amp\Parallel\Context\run() to create a context automatically based on installed extensions (i.e., a child process or a thread if ext-parallel is installed).
  • Fixed killing a child process if starting the process failed (#96).
v1.2.0
  • Added support for ext-parallel for thread contexts and workers.
  • Added BootstrapWorkerFactory which includes a user-defined file when a worker is created. This is useful for including a custom autoloader or other bootstrapping logic.
  • Added an optional bootstrap file path to WorkerProcess and WorkerThread constructors.
  • Improved stack traces reported from uncaught exceptions in contexts to report the stack trace of any previous exception.
  • Contexts now define a AMP_CONTEXT constant for identifying what type of context is running and a AMP_CONTEXT_ID constant, a unique integer identifier for that context.
  • ChannelledSocket has reference() and unreference() methods that reference and unreference the underlying socket in the event loop.
v1.1.1
  • Improved the error message received in the parent process if the child process exits without resolving a promise or coroutine returned from the process callback.
  • Fixed an issue where killing a child process would not fail any pending promises returned from Process::join(), Process::receive(), or Process::send().
  • Fixed regression in 1.1.0 of orphaned child processes resulting from a pool instance being destroyed. Be sure to call Pool::shutdown() to end worker processes gracefully.
v1.1.0
  • Added Worker\CallableTask and Worker\enqueueCallable() function to execute serializable callables in a worker without defining a class implementing Task.
  • The promise returned from Context\Process::start() now resolves to the process PID instead of null.
  • Workers are now gracefully shutdown when a process exits (#68). Note that using CTRL-C immediately ends the PHP process, so workers are immediately killed. To gracefully shutdown workers or worker pools, a signal handler must be defined for SIGINT/SIGTERM to allow the PHP process to continue execution (even if that handler ends the process by stopping the event loop).
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport