Download the PHP package phptg/transport-psr without Composer
On this page you can find all versions of the php package phptg/transport-psr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package transport-psr
The package provides for phptg/bot-api:
PsrTransport— PSR-18 and PSR-17 compatible transport implementation;PsrWebhookResponseFactory— PSR-7 webhook response factory;PsrUpdateFactory— factory for creatingUpdateobjects from PSR-7 server requests.
It allows you to use any PSR-compliant HTTP client to make requests to the Telegram Bot API.
[!IMPORTANT] This project is developed and maintained by Sergei Predvoditelev. Community support helps keep the project actively developed and well maintained. You can support the project using the following services:
Thank you for your support ❤️
Requirements
- PHP 8.2 - 8.5.
Installation
The package can be installed with Composer:
General usage
First, install a PSR-18 HTTP client and PSR-17 HTTP factories. For example, you can use php-http/curl-client and httpsoft/http-message:
PSR transport
Create an instance of PsrTransport and pass it to TelegramBotApi:
PsrTransport constructor parameters:
$client— PSR-18 HTTP client;$requestFactory— PSR-17 HTTP request factory;$streamFactory— PSR-17 HTTP stream factory.
PSR webhook response factory
The PsrWebhookResponseFactory creates PSR-7 compliant HTTP responses for webhook handlers:
The factory automatically:
- encodes the data as JSON;
- sets the
Content-Typeheader toapplication/json; charset=utf-8; - sets the
Content-Lengthheader.
PSR update factory
The PsrUpdateFactory creates Update objects from PSR-7 server requests in webhook handlers:
Documentation
- Internals
If you have any questions or problems with this package, use author telegram chat for communication.
License
The phptg/transport-psr is free software. It is released under the terms of the BSD License.
Please see LICENSE for more information.
All versions of transport-psr with dependencies
php-http/multipart-stream-builder Version ^1.4.2
phptg/bot-api Version ^0.20 || ^0.21 || ^0.22
psr/http-client Version ^1.0
psr/http-factory Version ^1.1
psr/http-message Version ^1.1 || ^2.0