Download the PHP package hoangkhacphuc/zalobot-sdk without Composer

On this page you can find all versions of the php package hoangkhacphuc/zalobot-sdk. 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 zalobot-sdk

ZaloBot SDK for PHP

Latest Stable Version License Total Downloads PHP Version CI

Lightweight, modular PHP SDK for the Zalo Bot Platform API. Zero framework coupling, PSR-18 HTTP client support, strict types (PHP 8.1+).

Port of the Node.js zalobot-sdk.

Installation

Requirements

Quick Start

Custom PSR-18 Client

Inject your own PSR-18 client — no Guzzle dependency required on your side:

Sending Messages

Webhook Handling

User Profile (with Cache)

Media Upload

Media Download

Error Handling

All SDK exceptions extend ZaloBotException:

Exception When
ApiException API error response or malformed JSON from server
AuthException Invalid or expired bot token (HTTP 401/403)
RateLimitException HTTP 429 — use $e->getRetryAfter() for backoff seconds
WebhookException Webhook secret mismatch
ValidationException Input validation failure or SSRF URL rejection
NetworkException Connection failure (DNS, TLS, transport — from PSR-18 client)
TimeoutException Request timeout (detected via Guzzle context, not message parsing)

Programming errors (TypeError, Error, LogicException, InvalidArgumentException) are never caught and masked — they propagate unchanged so bugs surface immediately.

Retry Policy

Automatic retry is read-only safe by default: only GET requests are retried. POST / PUT / upload requests are never auto-retried unless you opt in.

Status Retried?
408, 429, 502, 503, 504 ✅ yes (GET only by default)
Network connection failure ✅ yes (GET only, transient — not a timeout)
400, 401, 403, 404, 422 ❌ never
Timeout ❌ never

To opt in to mutating-request retries (only if your operations are idempotent):

Backoff uses exponential delay with jitter and respects the Retry-After header (seconds or HTTP-date format). Guzzle timeouts are detected via handler context (errno 28 / timed_out) and mapped to TimeoutException — not retried.

Download Redirect Policy

MediaModule::downloadMedia() does not follow HTTP redirects. A 3xx response is treated as a failure because the redirect target may be a private host that bypassed the initial SSRF validation.

Environment Variables

Variable Default Description
ZALO_BOT_TOKEN required Bot token from bot.zapps.me
ZALO_BOT_SECRET null Webhook secret (8–256 chars)
ZALO_BOT_TIMEOUT 30000 Request timeout in milliseconds
ZALO_BOT_MAX_RETRIES 3 Max retry attempts for 429 / transient errors
ZALO_BOT_BASE_URL https://bot-api.zaloplatforms.com API base URL

Development

License

MIT — see LICENSE for details.


All versions of zalobot-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
psr/http-client Version ^1.0
psr/http-message Version ^2.0
guzzlehttp/guzzle Version ^7.0 || ^8.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 hoangkhacphuc/zalobot-sdk contains the following files

Loading the files please wait ...