Repolode
hhxsv5

hhxsv5/laravel-s

An adapter that runs Laravel and Lumen applications on Swoole as a long-lived, memory-resident PHP server with WebSocket, TCP/UDP and async task support.

Stars
3,879
Forks
463
Open issues
70
Last commit
5 days ago

What is it?

LaravelS connects Laravel and Lumen applications to Swoole, so a PHP app can run as a persistent server process instead of being bootstrapped on every request. It is installed through Composer, published with a single artisan command, and started with a bin/laravels script that manages master, manager, worker and task processes.

Beyond serving HTTP, the package adds a built-in WebSocket server with a handler interface, multi-port mixed protocol support for custom TCP, UDP and HTTP listeners, asynchronous events and task queues, and millisecond-level cron jobs that can replace Linux crontab. It also provides custom processes, SwooleTable shared memory, and a configuration that supports graceful reload and code-change auto-reload via inotify, fswatch or inotifywait.

The project requires PHP 8.2 or later, Swoole 5.0 or later, and Laravel or Lumen 10 or later. Its README includes example Nginx and Apache reverse proxy configurations for serving static files alongside the Swoole process.

Key features

  • 01Built-in HTTP and WebSocket server with a handler interface for WebSocket events
  • 02Multi-port mixed protocol for custom TCP, UDP and HTTP listeners
  • 03Asynchronous event listeners and task queue running in Swoole task workers
  • 04Millisecond-level cron jobs that can replace Linux crontab
  • 05Graceful reload and automatic reload after code changes
  • 06SwooleTable shared memory and custom long-running processes

Use cases

  • Serving a Laravel app with persistent workers to reduce per-request bootstrap overhead
  • Adding a real-time WebSocket push channel to an existing Laravel application
  • Building custom TCP or UDP services that share code and database access with a Laravel app
  • Replacing Linux crontab entries with in-process millisecond timers and scheduled Laravel commands

Quick start

  1. 1

    Require the package via Composer

    composer require "hhxsv5/laravel-s:~3.8.0"
  2. 2

    Publish the configuration and binaries

    php artisan laravels publish
  3. 3

    Adjust listen_ip and listen_port in config/laravels.php as needed

  4. 4

    Start LaravelS

    php bin/laravels start

Things to know

  • Requires the Swoole extension (>=5.0) and PHP >=8.2 with the intl extension, so it is not a drop-in replacement for standard PHP-FPM hosting.
  • Runs as a long-lived, memory-resident server, so code and state persist between requests and need care; read the README's important notices before running.

In collections

Topics

FAQ

What is laravel-s?
An adapter that runs Laravel and Lumen applications on Swoole as a long-lived, memory-resident PHP server with WebSocket, TCP/UDP and async task support. LaravelS connects Laravel and Lumen applications to Swoole, so a PHP app can run as a persistent server process instead of being bootstrapped on every request. It is installed through Composer, published with a single artisan command, and started with a bin/laravels script that manages master, manager, worker and task processes.
Is laravel-s free to use? What license does it have?
laravel-s is open source under the MIT license. Check the license terms before using it in commercial products.
Is laravel-s still maintained?
Actively maintained. The last commit to laravel-s was on Nov 2, 2026.
What can I use laravel-s for?
Serving a Laravel app with persistent workers to reduce per-request bootstrap overhead Adding a real-time WebSocket push channel to an existing Laravel application Building custom TCP or UDP services that share code and database access with a Laravel app Replacing Linux crontab entries with in-process millisecond timers and scheduled Laravel commands
How do I install laravel-s?
Require the package via Composer: composer require "hhxsv5/laravel-s:~3.8.0" Publish the configuration and binaries: php artisan laravels publish Adjust listen_ip and listen_port in config/laravels.php as needed Start LaravelS: php bin/laravels start
Where can I get laravel-s?
The source code and installation instructions are on GitHub: https://github.com/hhxsv5/laravel-s

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects