Download the PHP package afaztech/reactor-broadcast without Composer

On this page you can find all versions of the php package afaztech/reactor-broadcast. 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 reactor-broadcast

Reactor Broadcast

Broadcast (send / copy / forward) with progress statistics for Reactor bots.

This package is built specifically for the Reactor PHP framework. It requires afaztech/reactor-framework ^0.5.0 and will not work standalone.

PHP Version Framework


Overview

Reactor Broadcast delivers mass messages to every user of a Telegram bot without blocking the bot's main loop. Jobs are processed asynchronously through the Reactor queue, progress is tracked per recipient, and the whole flow can be paused, resumed or cancelled at any time.

Three delivery strategies are available:

Strategy Description
send Send a fresh text message (optional inline/reply keyboard).
copy Copy an existing message from any chat. No "Forwarded from" label.
forward Forward an existing message from any chat, with the "Forwarded from" label.

Every recipient is recorded in a dedicated table with one of four states: pending, sent, failed, or blocked. Aggregate counters are updated live so the operator can watch progress in real time.


Requirements


Installation

Install the package through Composer. The service provider is auto-discovered through Composer metadata (extra.reactor.providers), so no manual registration is required.

Run the migrations to create the broadcasts and broadcast_recipients tables:

Start the queue worker that will process the broadcasts:

In production, run the worker under a supervisor (systemd, supervisord, ...) so it restarts automatically after a crash.


Configuration

The package is configured programmatically through the fluent BroadcastConfig value object. There is no config file to publish.

Bind BroadcastConfig in your application's service provider. The package registers an empty default when the application does not override it, so a bare setup works out of the box:

Available setters

Method Default Description
table(string $name) users Table that stores your users.
column(string $name) user_id Column holding the Telegram user ID.
onlyActive(string $column, mixed $value) disabled Only include rows where $column = $value.
withoutActiveFilter() — Disable the active-user filter.
onlyRecent(string $column, int $days) disabled Only include rows newer than $days.
withoutRecentFilter() — Disable the recent-interaction filter.
where(string $col, string $op, mixed $val) — Add a raw WHERE clause. Callable multiple times.
withoutRawFilters() — Clear all raw filters.
chunkSize(int $size) 500 Recipients per batch when collecting IDs.
batchDelayMs(int $ms) 200 Delay between batches in milliseconds.
cancelCheckEvery(int $n) 50 Check pause/cancel status every N messages.
queue(string $name) broadcast Queue name used by the processing job.

Usage

Getting the manager

Start a text broadcast

Copy an existing message

The message will be delivered to every recipient without the "Forwarded from" label.

Forward an existing message

The message will be delivered with the "Forwarded from" label.

Send to a custom list of recipients

Pass $recipientIds to bypass the configured RecipientProviderInterface and target a specific set of users.

Get progress

Control a running broadcast

A paused broadcast keeps its progress. Resuming re-queues the processing job and continues from the first pending recipient, so no user receives a message twice.


Status lifecycle


Example handlers

Two ready-to-use handlers for a test bot. No access control is applied — add an admin check before deploying to production.

Start a broadcast by replying to a message

Check broadcast progress


Custom recipient providers

If your users are not stored in a single table, or require logic that the ConfigurableRecipientProvider cannot express, implement RecipientProviderInterface and bind it in your application's service provider. The binding overrides the package default.

Then in AppServiceProvider:


Error handling

The processing job classifies every failure automatically:

Exception Behavior
RateLimitException Waits exactly retry_after seconds, then retries the same recipient.
PermanentException with "blocked" / "deactivated" / "kicked" Marks recipient as blocked. Increments the blocked counter.
PermanentException (other) Marks recipient as failed. Stores the error message.
TransientException Marks recipient as failed.
Any other Throwable Marks recipient as failed and logs the error.

Testing the package locally

To develop against a local checkout, add a path repository in your application's composer.json:

The framework must also be a path repository or a tagged release of ^0.5.0. When the framework is checked out locally, add a branch-alias to its composer.json so dev-main is treated as 0.5.x-dev:


License

MIT. See LICENSE.


All versions of reactor-broadcast with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
afaztech/reactor-framework Version ^0.5.0
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 afaztech/reactor-broadcast contains the following files

Loading the files please wait ...