This is a simple MVC application to interact with Slack which is written in PHP and using Swoole framework.
Make sure that you've already installed Swoole. you can use this link to do it.
To run it, at first you need to change the token property with yours in the file BaseModel.php
located in the src/Models
folder.
Then try to Dumps the autoloader
by just one of the following commands:
composer dump-autoload
or
composer install
Also, make sure Composer has already installed otherwise check this link.
and then you can run it in the root folder by PHP built-in web server like this:
php -S localhost:8000
or any ports you would like.
and to use a real-time sending and replying to messages, be sure to open their sockets with these commands from root folder:
php src/Sockets/SendMessage.php
php src/Sockets/ReplyMessage.php
php src/Sockets/DeleteMessage.php
If you freaked out why you should run all of these commands, you can also easily run them in supervisor without running each separately by putting them in supervisor configuration.
The responses are API like and here the views are separated and also you can use it in your use cases or you can extend it with your codes.
Also, the project is MVC like and as you can see the layers are separated into model, view, and controller logics located in src
.
- Tokens and Authentication
- Sending message
[url]/messages/send?channel=[put-channel-id-here]&text=[put-text-here]
- Replying to messages and creating threads
[url]/messages/reply?channel=[put-channel-id-here]&text=[put-text-here]&thread_ts=[put-message-ts-here]
- Deleting a message
[url]/messages/delete?channel=[put-channel-id-here]&ts=[put-message-ts-here]
- Getting a list of channels
[url]/
[url]/channels
- Getting a channel's info
[url]/channels/info?channel=[put-channel-id-here]
- Joining a channel
[url]/channels/join?name=[put-channel-name-here]
- Leaving a channel
[url]/messages/leave?channel=[put-channel-id-here]
- Channels List
- Channel Messages
- Real-Time Messaging
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update the tests as appropriate.