- How do I install overtrue/easy-sms in a Laravel application?
- Install it with Composer using composer require overtrue/easy-sms. In Laravel, define your gateway configuration and instantiate or bind the EasySms manager in a service provider. Follow the README for the exact setup steps for your package version.
- Which PHP and Laravel versions does easy-sms support?
- easy-sms is a PHP package that works inside Laravel applications, but recent releases can require PHP 8.4+ because of the libphonenumber-for-php integration. Check the composer.json constraints for the exact version you plan to install. If you are on PHP 8.0 or 8.1, test carefully or consider an older release or fork.
- Can I switch SMS providers without changing application code?
- Yes, easy-sms provides a unified API across many SMS providers, so you configure gateways instead of rewriting send logic. You can add, remove, or reorder providers through configuration. This makes migration between gateways and multi-provider setups much easier.
- How does failover and load balancing work in easy-sms?
- The package includes round-robin strategies, automatic selection of available providers, and support for custom strategies. You configure multiple gateways and let the manager route sends across them. In production, confirm provider health checks and rate limits because failover depends on gateway responses and your configuration.
- How do I send verification codes and template SMS messages?
- easy-sms supports templates and verification-code style messages through its unified message API. You pass the provider template ID or content along with the recipient data. Store provider-specific template IDs in config or environment variables so you can swap gateways cleanly.
- How should I validate phone numbers before sending SMS with easy-sms?
- The libphonenumber-for-php integration encourages E.164 validation, which reduces malformed international sends. Parse and format numbers with PhoneNumberUtil before passing them to easy-sms. If you accept local formats, add a normalization layer and test edge cases such as numbers beginning with 0.
- Will E.164 phone validation break my existing Laravel tests?
- It can if your tests use local or non-standard phone formats instead of E.164 values. Update fixtures to numbers like +15551234567 or mock the phone-number validation layer. Also test any custom validation rules you use to normalize local input before sending.
- What changed with the SmsSent event in easy-sms?
- The SmsSent event triggering logic was refined to keep state management consistent across channels, which matters for event-driven workflows. If you have custom listeners for notifications, analytics, or retries, retest them after upgrading. The event system also supports provider-specific hooks for more granular control.
- Are there provider-specific issues with Alibaba Cloud or Yunxin in easy-sms?
- Recent updates addressed deprecated endpoints and API quirks for Yunxin and Alibaba Cloud, so retest those integrations in staging. Alibaba's authentication service gateway may introduce different auth flows or rate limits. Review the official provider documentation and your credentials before deploying.
- What are the alternatives to easy-sms, and how do I evaluate maintenance?
- Alternatives include provider-specific SDKs, Laravel notification channels, and other multi-gateway SMS packages. Compare provider coverage, PHP version requirements, release cadence, and failover or event support. easy-sms is widely used with broad Chinese provider support, but pin versions and plan an upgrade or LTS strategy for production.