Download the PHP package phasync/swerve-spiral without Composer

On this page you can find all versions of the php package phasync/swerve-spiral. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package swerve-spiral

swerve for Spiral

CI Packagist PHP License

Your Spiral application, booted once and kept warm. swerve is a PHP application server: long-running workers that serve HTTP/1.1 themselves, stream request and response bodies, and hold WebSockets and Server-Sent Events. This package lets it run a Spiral application unchanged.

A worker serves one request at a time: a request waiting on a database or API holds its worker until it returns. Each request still gets its own Spiral ContainerScope, swapped by phasync::onScopeChange(), so code that runs after another request's handle() has returned (a WebSocket callback, a Server-Sent Events body) never sees that request's container. Capacity scales with --workers, as with RoadRunner. Details: docs/concurrency.md.

The framework running correctly on swerve does not mean your application does: state your own code keeps in statics, globals or shared services, and connections shared between requests, need the same care. See Making your application safe for concurrent requests. phasync/doctor lists the candidates in your code: composer require --dev phasync/doctor, then vendor/bin/phasync-doctor.

That's the whole setup. --adapter=spiral picks this adapter over swerve-psr15's, which comes with it (or put "extra": {"swerve": {"adapter": "spiral"}} in your composer.json). app.php stays as it is, so the same application still runs under RoadRunner. A kernel or exception handler other than the skeleton's App\Application\Kernel and App\Application\Exception\Handler goes in as kernel: and exceptionHandler:, in a swerve.php run with --adapter=swerve:

The handler is a PSR-15 request handler, served by swerve-psr15's Bridge.

WebSockets

A controller action returns swerve-psr15's WebSocketResponse::from(): a 101 and a callback that gets swerve's WebSocket and runs on the connection, or a 426 for an ordinary request to the same route.

Server push. Swerve::subscribe() receives what any worker publishes, so an ordinary action reaches the sockets of every worker:

The callback ends when its client leaves, with or without a close frame, and a shutdown or reload closes every socket with 1001.

The user. The callback runs after the request has ended, outside its scope. Take what it needs in the action:

Inside the callback the session is out of scope (ContainerException: Proxy is out of scope), and ContainerScope::getContainer() is null, also while another request runs in the worker: Spiral never hands the callback another request's scope. Leave the ORM alone there too.

Open sockets don't hold the worker: the tests keep 250 on one worker, half of them forwarding a subscription, while it answers ordinary requests at once. Messages from one publisher reach every subscriber in the order it published them; there is no order between different workers' publishers unless they publish through a Swerve\OrderedChannel.

How it runs

Before you deploy

Compatibility

Spiral PHP ext-phasync
3.15 and later, tested with 3.17 (spiral/app 3.9 on PHP 8.4+, 3.8 below) 8.2 – 8.5 optional; tested with and without

License

MIT. See the Ennerd philosophy for why this stack is built to be owned.


All versions of swerve-spiral with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
phasync/phasync Version ^2.0
phasync/swerve Version ^0.1
phasync/swerve-psr15 Version ^0.1
psr/http-server-handler Version ^1.0
spiral/framework Version ^3.15
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phasync/swerve-spiral contains the following files

Loading the files please wait ...