Skip to main content

2 posts tagged with "nutgram"

View All Tags

ยท 2 min read

We are thrilled to unveil Nutgram 4.x, an exciting update packed with new features and improvements to enhance your Telegram bot development experience. Here's a closer look at the key changes:

PHP 8.2โ€‹

To ensure a smooth transition, make sure to update your dependencies as now is required PHP 8.2.0 or greater. This higher requirement unlocks new capabilities and improvements, so be sure to prepare your environment accordingly.

Endpoint Signatureโ€‹

One of the significant changes in 4.x is the conversion of all endpoint signatures from an array to named parameters. This update enables the convenient utilization of named parameters and improves parameter sorting. Mandatory parameters now come first, followed by optional ones, while the $clientOpt parameter, if present, will always be placed at the end.

For example, previously, you might have used:

$bot->sendMessage('my text', [
'disable_notification' => true
]);

In 4.x, has to be changed to:

$bot->sendMessage('my text',
disable_notification: true
);

->group Methodโ€‹

The group method has undergone modifications in its usage. Previously, it accepted the middleware as a parameter, but now the middleware is set using the middleware method. Update your code to reflect this change:

$bot->group(function (Nutgram $bot){
// Your handlers here
})->middleware(Middleware::class);

Enumsโ€‹

In 4.x, we have converted Attributes (Class with constants) to Enums. If you were directly using the value before, you will now need to use ->value to obtain the raw value. This change has a medium impact and should be addressed during the upgrade.

Laravel Support Moved to a Separate Packageโ€‹

With the latest update, we have separated the Laravel support into a new package called nutgram/laravel. You have to install this package using Composer:

composer require nutgram/laravel

To streamline the integration process, the previous package, nutgram/nutgram, is now included within nutgram/laravel. Once you have nutgram/laravel installed, you can safely remove nutgram/nutgram as it is already incorporated.

These high-impact changes require your attention to ensure a seamless transition to 4.x. Be sure to update your code accordingly to take full advantage of the new features and improvements.

We encourage you to explore the complete upgrade guide and review the changes in the repository on GitHub. Upgrade now and elevate your Telegram bot development to new heights. Happy coding!

ยท One min read

We are excited to announce that a new bundle is now available for developers using Symfony with Nutgram! ๐Ÿฅณ The bundle provides seamless integration with Symfony and unlocks new features and functionality for developers to create even more powerful and customizable bots. We believe this addition will enhance the development experience for our community and look forward to seeing what our users will create with this new tool.

Check out the new documentation page ๐Ÿ—„