Download the PHP package reymon/easy-keyboard without Composer

On this page you can find all versions of the php package reymon/easy-keyboard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package easy-keyboard

EasyKeyboard

Simple reply & inline telegram api keyboard

Table of Contents
  1. Installation
  2. Usage
    1. Defining a Keyboard
    2. Defining Buttons
    3. Bind Buttons to a Keyboard
      1. By Row
      2. By Button
      3. By Coordinates
      4. As Stack
    4. KeyboardForceReply and KeyboardHide
    5. Keyboard Peer Type
    6. Convert Telegram Keyboard To Easy Keyboard

Installation

Install the package using composer:

(back to top)

Usage

If you need to create a keyboard you can use the classes provided by this package as a drop-in replacement.

This is best explained with an example:

A ReplyKeyboardMarkup is created by calling the static new() method on KeyboardMarkup. After that every field, like singleUse, ... add some extras. Buttons can be added by calling the addButton() method. We have a detailed look on that later.

(back to top)

Defining a Keyboard

You can create a keyboard by calling the static new() method on its class.

After that you can chain methods to set additional fields that are available in the Bot API. This is done by calling the placeholder() method.

(back to top)

Defining Buttons

The Buttons are created in the different way:

This is done the same way for InlineButton:

(back to top)

Bind Buttons to a Keyboard

The keyboard does not work without any buttons, so you need to pass the buttons to the keyboard. There are a few ways to do this.

By Row

If you need more than one row, call row() multiple times:

You can add array of callbacks or texts keyboard in another way!

You can even use these methods

for InlineKeyboard:

and for ReplyKeyboard:

By Button

If you need more than one row, just call the row method without arguments, and continue calling addButton():

It's up to you if you define your buttons inline like in these examples or if you'd like to generate a whole row beforehand and pass the variable to the row() method.

You can remove the last button by calling remove method here is an example :

In this example button D will remove from buttons.

By Coordinates

You can add button to each coordinates you want! (Note that coordinates start from 0 just like array indexes.) for example imagine we have this keyboard :

we can add new button with it coordinates(raw and column) by calling addToCoordinates method. This methods will add new button in the coordinate that you passed and shift next buttons of the coordinates. This picture show you the position of new button :

Screenshot_20230907_212829

The results should like this image :

Screenshot_20230907_213111

You can also replace into specific coordinates unlike addToCoordinates the replaceIntoCoordinates method will replace your new button into passed coordinate for example if we want to replace Add in this example like this picture :

Screenshot_20230907_213957

we should use this code :

The result should like this image :

Screenshot_20230907_214232

You can also remove the button by it's coordinates for example if we want remove Add button(in last example) we should run this code:

As Stack

If you want to add a bunch of buttons that have each a row for themselves you can use the Stack() method.

You can mix and match the row(), Stack() and addButton() methods as it fits your needs.

(back to top)

KeyboardForceReply and KeyboardHide

KeyboardForceReply and KeyboardHide can be used the same way as a normal keyboard, but they do not receive any buttons:

(back to top)

Keyboard Peer Type

We have 3 types of peer type can be requested by bots RequestUsers , RequestGroup and RequestChannel

You can also use easier syntax to create better one

(back to top)

Convert Telegram Keyboard To Easy Keyboard

You can now easily convert telegram keyboards to easy keyboard for modify and ... using tryFrom methods! here is and example

As you know $easyKeyboard is object here and you can modify and add more buttons to it. here is an example if $easyKeyboard instance of KeyboardInline

(back to top)


All versions of easy-keyboard with dependencies

PHP Build Version
Package Version
Requires php-64bit Version >=8.1
ext-mbstring Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package reymon/easy-keyboard contains the following files

Loading the files please wait ....