Weave 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

Server Bundle Laravel Package

toro/server-bundle

Symfony bundle that integrates the Toro PHP server runtime into your application, registering its services in the DI container and exposing configuration plus console commands for starting, stopping, and monitoring background workers from the familiar Symfony toolchain.

View on GitHub
Deep Wiki
Context7

Getting Started

Assume from the start that this is a legacy integration: the bundle targets Symfony2 (PHP 5.x era) and pins a ReactPHP-based toro server. Before writing any code, check three things in the repo:

  1. composer.json — the symfony/symfony range, the toro/toro (or equivalent runtime) version it pulls, and the PHP constraint. If it requires ~2.3/~2.7 and PHP >=5.4, budget for a fork before it will install alongside anything modern.
  2. DependencyInjection/ToroServerExtension.php and the bundle class — confirm the service alias and parameter prefix (typically toro_server.*). That is your extension point for everything else.
  3. Command/ — the console command that boots the server. That command is your real entry point; the bundle is mostly a thin wrapper around it.

Minimal wiring:

// app/AppKernel.php
$bundles = [
    // ...
    new Toro\Bundle\ServerBundle\ToroServerBundle(),
];
# app/config/config.yml
toro_server:
    host: 127.0.0.1
    port: 8080
    # worker count / document root keys vary by version — read the Extension class

First use case to validate the install: run the bundle's server command in the foreground against your existing app.php front controller, confirm it binds and serves one request, and confirm the process handles a second request without restarting. If it cannot serve request #2, nothing downstream matters.

You will not find meaningful documentation at 0 stars — treat README.md, the test suite (if any), and the Extension class as the specification.

Implementation Patterns

Treat the server command as the integration point, not the bundle. The bundle's job is to register a console command and a small set of DI services. Everything real happens in the worker loop, which you control through the command.

Wrap the front controller, don't rewrite it. The typical pattern is to point the server at a small bootstrap script that dispatches through the Symfony kernel, so your existing routing, security, and controllers are unchanged:

// bin/toro-app.php
require __DIR__.'/../app/autoload.php';
$kernel = new AppKernel(getenv('APP_ENV') ?: 'prod', false);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Scope services for long-running workers. Anything holding per-request state (a request-scoped logger, a session, a user token, a Doctrine EntityManager) must be reset between requests or marked non-shared. A common pattern is a small "resetter" service called from the worker loop:

foreach ($this->resetters as $resetter) {
    $resetter->reset(); // clear EM, detach handlers, reset locale/user
}

Separate the "dev server" and "production worker" use cases. For dev, run the command in the foreground with a watcher and short worker lifetime so code changes reload. For production, define it as a supervised process (systemd unit or supervisord), one process per CPU, with an explicit worker count.

Integration with the container: register your own compiler pass if you want to auto-collect resetters — tag services toro.resetter, collect in process(), inject the array into the worker loop. This is the only clean extension point the bundle realistically offers.

If the bundle is unmaintained, vendor the pattern. Because the surface is small, the pragmatic long-term move is to lift the command into your own AppBundle and drop the dependency, keeping your config keys identical so migration is a no-op for the rest of the app.

Gotchas and Tips

  • Symfony2 pin is a hard wall. It will not install into Symfony 3/4/5/6 projects. If you are on a modern stack, you are reading this package for design inspiration, not for use.
  • Long-running processes leak by default. The kernel is booted once; every shared service keeps whatever it accumulated. Watch memory under load with a loop of 1000 requests before trusting it. Reset the Doctrine EntityManager ($em->clear(), $em->getConnection()->close()) every N requests.
  • Request::createFromGlobals() is wrong in a worker. It reads $_SERVER/$_GET once. Bind per-connection and construct the Request from the actual socket data, or the second request will silently reuse the first.
  • Static and superglobal state persists. $_SESSION, $_SERVER, and any static caches in your code carry over. Explicitly reinitialize per request or you get cross-user data bleed — a security issue, not just a bug.
  • Sessions and uploads need explicit handling. File uploads land in temp files that persist for the process lifetime; sessions backed by the native handler can behave unexpectedly since session_start() semantics differ per request cycle.
  • Debugging is by log, not by dump(). In a forked/worker model var_dump goes to the server's stdout, not the HTTP response. Prefer Monolog with a rotating handler and a distinct channel for the worker.
  • Config key names drift between minor versions. Read Configuration.php in the bundle — do not trust the README, and definitely do not trust blog posts for a package this obscure.
  • Port binding failures are silent-ish. The command often exits non-zero with a short message; check $? and wire it into your supervisor's restart policy.
  • No release since 2017 means no security patches. Audit the transitive ReactPHP dependency tree with composer audit / roave/security-advisories and pin everything.
  • Extension points are limited by design. The realistic ones are the console command, a compiler pass for tagged services, and (if present) a factory interface for the server instance. Everything else requires forking.
  • Verdict guidance: evaluate this only if you are maintaining a Symfony2 application and genuinely need an in-process server for benchmarking or a niche long-poll use case. For anything new, use symfony/web-server-bundle for dev and a real web server (nginx + php-fpm) for production.
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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle