DEF STUDIO srl

Need help with Laravel and web development?

Hire one of our experts for your projects.

We build tailored products, websites and platforms — with care for UX, performance and maintainability.

Booking open for Q4 — limited slots

You are seeing the documentation for version 1, but the last version for this package is v1. Click here to go to the last version.

TelegraphResponse

all Telegraph requests return a TelegraphResponse that extends the original Illuminate\Http\Client\Response adding some useful methods:

All Illuminate\Http\Client\Response methods

As TelegraphResponse extends Illuminate\Http\Client\Response, it inherits all its methods:

$response = Telegraph::message('hello')->send();

$response->successful();
$response->ok();
$response->failed();
$response->body();
$response->json('path.to.json.data', 'default');

//.. and so on

telegraphOk

Returns true if the Telegram request is successful and contains ['ok' => true] in its body

$response = Telegraph::message('hello')->send();

$response->telegraphOk(); //true

telegraphError

Returns true if the Telegram request is not successful or is successful but doesn't contain ['ok' => true] in its body

$response = Telegraph::message('hello')->send();

$response->telegraphError(); //false

telegraphMessageId

Returns the ID of the message posted on the Telegraph chat (null if the request failed or no message was posted)

$response = Telegraph::message('hello')->send();

$response->telegraphMessageId(); //4568

dump

print a dump() of the response for testing purposes

$response = Telegraph::message('hello')->send();

$response->dump();

dd

print a dd() of the response for testing purposes

$response = Telegraph::message('hello')->send();

$response->dd();
Suggest a change
Last updated 29 May 2026