Skip to main content
Version: 3.x



You can install the package as usual via Composer:

composer require nutgram/nutgram

If you are using Laravel or Symfony frameworks, be sure to read their dedicated pages for a better development experience.


The framework can work out-of-the-box without much configuration, the only mandatory parameter is (obviously) the Telegram API token:

use SergiX44\Nutgram\Nutgram;

$bot = new Nutgram('you telegram token here');

In addition, it's possible to specify a list of options as second argument, like that:

use SergiX44\Nutgram\Nutgram;

$config = [
'timeout' => 10, // default in seconds, when contacting the Telegram API

$bot = new Nutgram('you telegram token here', $config);

Here a list of all the options you can specify:


  • type: string
  • default: ''
  • Useful if you need to change to a local API server.


  • type: string
  • default: null
  • Useful when the bot is a group bot (with Group Privacy * *disabled**) and you need to specify the bot name.


  • type: boolean
  • default: false
  • Enable the local mode when used along a self-hosted Telegram Bot API server.
    Nutgram will copy the file from your Telegram Bot API server instead downloading it.


  • type: callable(string $path): string
  • default: null
  • Useful if you need to remap a relative file path when used along is_local config.


  • type: boolean
  • default: null
  • Enable test environments useful when working with Web Apps.


  • type: integer
  • default: 10
  • In seconds, define the timeout when sending requests to the Telegram API.


  • type: string or instance
  • default: ArrayCache
  • The object used to store conversation and data, must implements the PSR-16 CacheInterface.


  • type: array
  • default: []
  • An array of options for the underlying Guzzle HTTP client. Checkout the Guzzle documentation for further informations.


  • type: array
  • default: ['timeout' => 10, 'limit' => 100]
  • Contains all the options that used when requesting updates to Telegram via the getUpdates, it's possible to specify also the field allowed_updates if you want.


  • type: boolean
  • default: false
  • Split long text message to multiple messages.
    This is useful when you want to send a message longer than the maximum length allowed by Telegram.
    Available only with the sendMessage method. (It will returns an array of Message)
    Optional reply_markup parameter will be sent on last message.


IDE autocompletion

To enable IDE autocompletion, you can install the following plugin on your IDE:



IDE autocompletion