You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+122-6Lines changed: 122 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,21 @@
1
-
# mixin_labs-php-bot
2
-
Php bot for Mixin Network
1
+
# Mixin Messenger application development tutorial in PHP
2
+
This tutorial will let you know how to write a Mixin Messenger bot in PHP. The bot can receive and response to user's message. User can pay token to bot and bot can transfer token to user.
3
+
4
+
## Index
5
+
1.[Create bot and receive message from user](https://github.com/wenewzhang/mixin_labs-php-bot#create-bot-and-receive-message-from-user)
6
+
2.[Receive token and pay token](https://github.com/wenewzhang/mixin_labs-php-bot/blob/master/README2.md)
7
+
8
+
## Create bot and receive message from user
9
+
You will create a bot in Mixin Messenger to receive user message after read the chapter.
10
+
11
+
12
+
### PHP enviroment setup:
13
+
This tutorial is written in PHP 7. So you need to install PHP, composer before writing code.
Make sure the install directory is include in the $PATH variable, run **php -v** and **composer -V** can check the installation, if console output like below, that's mean it's works!
This tutorial need a library [mixin-sdk-php](https://github.com/ExinOne/mixin-sdk-php) and [Ratchet pawl](https://github.com/ratchetphp/Pawl), **mixin-sdk-php** is a PHP SDK for Mixin Network, the **Ratchet pawl** is a asynchronous websocket client.
86
+
So, add them in the "require" block.
87
+
```bash
88
+
"require": {
89
+
"exinone/mixin-sdk-php": "^1.1",
90
+
"ratchet/pawl": "^0.3.3",
91
+
},
92
+
```
93
+
Save the composer.json, then execute **composer install** to download the packages.
27
94
```bash
28
95
composer install
29
96
```
97
+
After the downloading finished, you can find a vendor under the project directory.
98
+
```bash
99
+
root@iZj6cbmqen2lqp7l48nfgkZ:~/mixin_labs-php-bot# ls
100
+
composer.json composer.lock vendor
101
+
```
102
+
If you clone this repository, just execute **composer install** to download all dependency packages.
103
+
104
+
### Create you first app in developer dashboard
105
+
Create an app by following [tutorial](https://mixin-network.gitbook.io/mixin-network/mixin-messenger-app/create-bot-account).
106
+
107
+
### Generate parameter for your app
108
+
Remember to [generate parameter](https://mixin-network.gitbook.io/mixin-network/mixin-messenger-app/create-bot-account#generate-secure-parameter-for-your-app)
109
+
and write down required information, they are required in config.php file soon.
0 commit comments