Skip to content

Conversation

@iqbalhasandev
Copy link
Member

This pull request introduces message content validation for SMS messages, ensuring that messages meet configurable requirements before being sent. The validation logic is configurable via the textify.php config file and is enforced in all providers. Comprehensive tests are included to verify the validation behavior for various scenarios.

Message Validation Feature:

  • Added a new validation section to config/textify.php to configure message requirements, including whether messages are required, minimum length, and maximum length.
  • Implemented the validateMessageContent method in BaseProvider.php to enforce these validation rules before sending a message. If validation fails, an error response is returned. [1] [2]

Testing and Coverage:

  • Added MessageValidationTest.php to cover all key validation scenarios: required/nullable messages, minimum/maximum length, valid messages, and whitespace-only messages.

Minor Codebase Cleanup:

  • Removed a redundant comment in the error code mapping of BulkSmsBdProvider.php.

iqbalhasandev and others added 2 commits September 9, 2025 16:39
…style validation rules

- Add message validation configuration to textify.php config
- Implement validation for required, min, and max message length
- Use Laravel-style validation naming (required, min, max) for consistency
- Add validateMessageContent() method to BaseProvider
- Enhanced error handling in all Bangladeshi SMS providers
- Add comprehensive MessageValidationTest suite
- Support for nullable messages when required=false
- Proper whitespace handling and error messages
- All tests passing with PHPStan validation

Fixes issue with ReveSMS error 114 'Content not provided' and similar validation issues across all providers.
@iqbalhasandev iqbalhasandev self-assigned this Sep 9, 2025
@iqbalhasandev iqbalhasandev added the enhancement New feature or request label Sep 9, 2025
@iqbalhasandev iqbalhasandev merged commit 7cebeaf into main Sep 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants