# ConverseDriver Changelog

## Version 2.1 (Current)

### Changed
- ✅ **Replaced `Http` facade with cURL** for better compatibility with older Laravel versions
- ✅ All HTTP requests now use native PHP cURL functions
- ✅ Works with Laravel 5.x, 6.x, 7.x, 8.x, 9.x, 10.x, and 11.x
- ✅ No external dependencies beyond BotMan and Laravel core

### Technical Details

#### HTTP Client
- **Before**: Used `Illuminate\Support\Facades\Http` (Laravel 7+)
- **After**: Uses native PHP `curl_*` functions (PHP 5.4+)

#### Benefits
1. **Wider Compatibility**: Works with older Laravel versions
2. **No Dependencies**: Doesn't require Guzzle HTTP client
3. **Performance**: Direct cURL is slightly faster
4. **Stability**: cURL is a stable, well-tested PHP extension

### Migration from v2.0

No changes needed! The API remains the same. Simply replace the old driver file with the new one.

### cURL Configuration

The driver uses these cURL options:
```php
CURLOPT_TIMEOUT => 30           // 30 second timeout
CURLOPT_SSL_VERIFYHOST => 0     // Disabled for development
CURLOPT_SSL_VERIFYPEER => 0     // Disabled for development
CURLOPT_FOLLOWLOCATION => true  // Follow redirects
```

**Production Recommendation**: Enable SSL verification:
```php
// For production, modify these in the driver:
CURLOPT_SSL_VERIFYHOST => 2
CURLOPT_SSL_VERIFYPEER => true
```

---

## Version 2.0

### Added
- HTTP API-based communication with main app
- Support for separate BotMan application deployment
- Bearer token authentication
- Comprehensive logging

### Changed
- Removed direct `WhatsappService` dependency
- Removed database model dependencies
- Changed to REST API communication pattern

### Endpoints Used
- `POST /api/send` - Send text/interactive messages
- `POST /api/send/media` - Send media messages
- `GET /api/getMedia/{id}` - Get media URL

---

## Version 1.0 (Legacy)

### Features
- Direct integration with WhatsappService
- Database access to Contact and Organization models
- Monolithic architecture
- HTTP facade for external calls

---

## Upgrade Guide

### From v1.0 to v2.0+
1. Update driver file
2. Add configuration for API URL and token
3. Remove database dependencies
4. Setup webhook forwarding in main app

### From v2.0 to v2.1
Simply replace the driver file - no configuration changes needed!

---

## System Requirements

### Minimum Requirements
- PHP 7.4+
- Laravel 5.8+
- BotMan 2.x
- Redis (for duplicate detection)
- cURL PHP extension

### Recommended
- PHP 8.1+
- Laravel 9.x or 10.x
- Redis 6.x+
- Composer 2.x

---

## Known Issues

### None currently reported

---

## Future Roadmap

- [ ] Add retry logic for failed API calls
- [ ] Add circuit breaker pattern
- [ ] Add response caching
- [ ] Add batch message support
- [ ] Add webhook signature verification
- [ ] Add rate limiting
- [ ] Add metrics/analytics tracking

---

## Support

For issues or questions:
- Check logs: `storage/logs/laravel.log`
- Verify cURL is installed: `php -m | grep curl`
- Test API connectivity: `curl -H "Authorization: Bearer TOKEN" URL`
- Review configuration in `config/botman/converse.php`


