MAX Messenger SDK Bot API PHP

Maintainers

Package info

github.com/VioletSun/MAX

Homepage

pkg:composer/violetsun/max

Transparency log

Statistics

Installs: 148

Dependents: 0

Suggesters: 0

Stars: 5

Open Issues: 0


README

API MAX Project Status

Laravel versions Laravel Latest Version on Packagist PHP version Total Downloads GitHub code size in bytes Software License

Installation

Installing root certificates for working with the MAX API2

  • Download root certificates https://www.gosuslugi.ru/crt
  • Install certificates sudo cp CERTIFICATE_NAME.crt /usr/local/share/ca-certificates/
  • Update the certificate store sudo update-ca-certificates

Via Composer

composer require violetsun/max

Package vendor publish

php artisan vendor:publish --provider="VioletSun\MAX\MAXServiceProvider"

or

php artisan vendor:publish --tag=max-config
php artisan vendor:publish --tag=max-migrations
php artisan vendor:publish --tag=max-models
php artisan vendor:publish --tag=max-assets
php artisan vendor:publish --tag=max-services

Migrations (after vendor publish)

php artisan migrate

.env

MAX_API_KEY="YOUR_MAX_API_KEY"

Usage

Send message

MAX::sendMessage(
    1234567890, 
    [
        'text' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.'
        // there will be more to come...
    ]
);

Send message with MessageBuilder

Max::builder()
    ->chatId(1234567890)
    ->text("Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
    ->attachments(function (AttachmentsBuilder $builder) {
        $builder->image(
            token: "TOKEN_IMAGE"
        );
        $builder->image(store: public_path('image.png'));
        $builder->video(
            token: "TOKEN_VIDEO"
        );
        $builder->inlineKeyboard(
            $builder->row(
                $builder->button->link(
                    text: "Lorem Ipsum 1",
                    url: "https://max.ru",
                ),
                $builder->button->callback(
                    text: "Lorem Ipsum 2",
                    payload: "lorem-ipsum-2",
                )
            ),
            $builder->button->callback(
                text: "Lorem Ipsum 3",
                payload: "lorem-ipsum-3",
            )
        );
    })
    ->send();

Change log

Please see the changelog for more information on what has changed recently.

Testing

composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email demettriss@gmail.com instead of using the issue tracker.

Credits

License

license file