Download the PHP package matheushasm/swoole-micro without Composer

On this page you can find all versions of the php package matheushasm/swoole-micro. 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 swoole-micro

Swoole Micro (MVP – Phase 1)

Swoole Micro is a lightweight toolkit to build PHP microservices and workers using Swoole processes + coroutines, with a clean architecture and pluggable components.

Phase 1 focuses on:

Design goals: simple, predictable, testable, framework-agnostic (Laravel support can be a separate bridge later).

Table of contents

Why

PHP + Swoole is powerful, but building robust microservice workers usually means:

This project provides a clean, consistent foundation to:

Architecture

High-level modules:

Core

Queue

Supervisor

CLI

Minimal command runner:

Rule: the core never depends on Laravel/Eloquent. Adapters/bridges come later.

Folder structure

Recommended structure for the repository:

Requirements

Extensions:

Dependencies overview:

Installation

Using Composer (as a package)

Local development (path repository)

In your app composer.json:

Then:

Platform setup

Windows (requires WSL2 for Swoole):

1) Install WSL2 + Ubuntu 2) Install PHP 8.2+ and Composer 3) Install Swoole + Redis extensions:

Mac (Homebrew):

Linux (Ubuntu/Debian):

Docker (example):

Quick start

Create config/workers.php:

Run a worker:

Run multiple worker instances:

Watch heartbeats:

CLI

The CLI includes an interactive mode and basic operational commands.

Interactive mode (menu-driven):

Commands:

Examples:

Core concepts

Processor

A Processor is the unit of work. It receives a payload and performs a task.

Contract:

Best practices:

BatchProcessor (easy mode)

If you want simple batch processing without dealing with coroutines directly, extend BatchProcessor. It runs one item at a time by default and can process items in parallel when you override maxConcurrency().

Contract:

Worker

A Worker is a long-running OS process (Swoole Process recommended) that:

CoroutinePool

A small utility that limits parallelism:

maxConcurrency(20) means at most 20 concurrent coroutines.

Perfect for:

QueueDriver

Queue is an interface. In phase 1 we ship an InMemory driver (dev/tests).

Contract:

Later you plug RabbitMQ / Redis.

Supervisor (Redis)

Supervisor stores worker heartbeats in Redis:

watch command checks dead workers by time threshold.

Examples

Example 1: A simple processor

examples/processors/SendEmailProcessor.php

Example 2: Worker consuming jobs from queue

Pseudo-usage (your Worker will do the loop):

Example 2.1: Running workers with Redis queue via CLI

Example 2.2: Spawning multiple instances

Example 2.3: Full Redis worker setup (Processor + CLI)

Example 3: Parallel processing with CoroutinePool

When you need to process a batch in parallel:

Use cases:

Example 3.1: Work inside a worker with extra coroutines

Example 3.2: BatchProcessor for simple parallelism

Fluent override:

Example 4: Supervisor heartbeat monitoring

Worker side:

Watcher side:

Configuration

Suggested env vars:

Worker-level config (phase 1):

Lifecycle and safety

Long-lived PHP processes require discipline.

Recommended lifecycle hooks (phase 1 can start minimal, but keep a place for them):

Safety rules (important):

Memory limits approach:

If memory grows beyond memoryLimitMb, worker should:

Roadmap

Phase 1 (this README)

Phase 2

Phase 3

License

MIT

Git Hooks

Run unit tests on every git push:

This enables .githooks/pre-push, which runs vendor/bin/phpunit.


All versions of swoole-micro with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-swoole Version *
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 matheushasm/swoole-micro contains the following files

Loading the files please wait ...