Download the PHP package tusharkhan/chatbot without Composer
On this page you can find all versions of the php package tusharkhan/chatbot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tusharkhan/chatbot
More information about tusharkhan/chatbot
Files in tusharkhan/chatbot
Package chatbot
Short Description ๐ค Modern PHP chatbot framework with multi-platform support (Telegram, Slack, Web). Build intelligent conversational bots with pattern matching, state management, and middleware. Works with any PHP framework or standalone.
License MIT
Informations about the package chatbot
TusharKhan Chatbot Package
A framework-agnostic PHP chatbot package that works seamlessly with plain PHP, Laravel, or any custom PHP application. Build powerful chatbots with multi-platform support including Web, Telegram, and Slack.
Package details
- PHP: >=8.0
- License: MIT
Note: The downloads badge above is provided by Packagist/Shields.io and will display live download counts after the package is published on Packagist. If you prefer to show a static number, replace the badge with the value from Packagist.
๐ Features
- Framework Agnostic: Works with any PHP framework or plain PHP
- Multi-Platform Support: Web, Telegram, and Slack drivers included
- Pattern Matching: Flexible message routing with parameters, wildcards, and regex
- Multi-turn Conversations: Stateful conversations with context management
- Storage Options: File-based or in-memory storage (easily extensible)
- Middleware Support: Add custom processing logic
- Fallback Handling: Graceful handling of unmatched messages
- Easy Setup: No complex configuration required
- Rich Messaging: Support for buttons, keyboards, attachments, and interactive components
- Modern Platform Features: Events API, slash commands, and interactive components
- Fully Tested: Comprehensive unit test coverage (79 tests, 202 assertions)
๐ฆ Installation
Install via Composer:
๐ฏ Quick Start
Basic Web Chatbot
Telegram Bot
Slack Bot
๐ง Pattern Matching
The bot supports various pattern matching types:
Exact Match
Wildcards
Parameters
Multiple Patterns
Regular Expressions
Custom Functions
๐ฌ Conversation Management
Handle multi-turn conversations with ease:
๐ Middleware
Add custom processing logic:
๐๏ธ Storage Options
File Storage (Persistent)
Array Storage (In-Memory)
Custom Storage
Implement the StorageInterface for custom storage solutions:
๐ Framework Integration
Laravel Integration
Plain PHP Integration
๐งช Testing
Run the test suite:
๐ Examples & Documentation
Working Examples
examples/web_driver.php- Complete web chatbot with ordering systemexamples/telegram.php- Full Telegram bot with commands and conversationsexamples/slack.php- Slack bot with interactive components
Comprehensive Guides
doc/web-driver-bot.md- WebDriver guide (plain PHP and Laravel)doc/telegram.md- Complete Telegram bot implementation guidedoc/slack-bot-example.md- Slack bot setup and real-world examples
๐ง Advanced Usage
Custom Drivers
Create custom drivers by implementing DriverInterface:
Error Handling
๐ API Reference
Bot Class
hears($pattern, $handler)- Add message handlerfallback($handler)- Set fallback handlermiddleware($middleware)- Add middlewarelisten()- Process incoming messagessay($message, $senderId)- Send messageconversation()- Get current conversationdriver()- Get driver instancestorage()- Get storage instance
Context Class
getMessage()- Get incoming messagegetSenderId()- Get sender IDgetConversation()- Get conversation instancegetDriver()- Get driver instancegetParams()- Get extracted parametersgetParam($key, $default)- Get specific parametergetData()- Get raw platform data
Conversation Class
setState($state)- Set conversation stategetState()- Get current stateisInState($state)- Check if in specific stateset($key, $value)- Set variableget($key, $default)- Get variablehas($key)- Check if variable existsremove($key)- Remove variableclear()- Clear all data
๐ Supported Platforms
Web Driver
- HTTP/AJAX requests
- Form submissions
- Session-based conversations
- JSON/HTML responses
- Laravel and plain PHP integration
Telegram API
- Bot Commands:
/start,/help, custom commands - Message Types: Text, photos, documents, stickers
- Keyboards: Inline and reply keyboards
- Webhook Support: Real-time message processing
- Rich Formatting: Markdown and HTML support
Slack API
- Events API: Real-time message events
- Slash Commands: Custom bot commands
- Interactive Components: Buttons, menus, and forms
- Rich Messaging: Block Kit for rich layouts
- Mentions & DMs: App mentions and direct messages
- Webhook Verification: Signature verification for security
๐ Security Features
- Input Validation: Built-in message sanitization
- Webhook Verification: Signature verification for Slack
- Rate Limiting: Middleware support for rate limiting
- Error Handling: Comprehensive error logging
- Storage Security: Secure file-based storage
๐ Package Statistics
- Total Tests: 79 tests with 193 assertions
- Code Coverage: Comprehensive coverage of all core features
- PHP Version: Requires PHP 8.0+
- Dependencies: Modern, actively maintained packages
- Package Size: Lightweight with minimal dependencies
๐ค Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐โโ๏ธ Support
- Create an Issue for bug reports
- Email: [email protected]
- Documentation: See
/docfolder for comprehensive guides
๐ Acknowledgments
- Built with modern PHP 8.0+ features
- Uses established libraries for platform integrations
- Framework-agnostic design for maximum compatibility
- Community-driven development
Made with โค๏ธ by Tushar Khan Portfolio: tusharkhan.me
All versions of chatbot with dependencies
jolicode/slack-php-api Version ^4.8
symfony/http-client Version ^6.0|^7.0
nyholm/psr7 Version ^1.8
irazasyed/telegram-bot-sdk Version ^3.9