Download the PHP package andrejro2/yeastar-gsm-laravel without Composer
On this page you can find all versions of the php package andrejro2/yeastar-gsm-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yeastar-gsm-laravel
Laravel Yeastar SMS
A Laravel package for sending SMS messages via Yeastar Gateway using the Asterisk Manager Interface (AMI) protocol. This package provides a clean, Laravel-friendly interface to interact with Yeastar GSM gateways.
Features
- ๐ Simple Integration - Easy-to-use Laravel facade and service container integration
- ๐ Secure Connection - Uses AMI protocol for secure communication with Yeastar gateways
- โ๏ธ Configurable - Multiple gateway support with environment-based configuration
- ๐งช Well Tested - Comprehensive test suite included
- ๐ Detailed Logging - Built-in logging support for debugging and monitoring
- ๐ฏ Type Safe - Full PHP 8.1+ type declarations and PHPDoc annotations
- ๐ Multiple Gateways - Support for multiple gateway configurations
- โฑ๏ธ Timeout Control - Configurable connection and read timeouts
Requirements
- PHP 8.1 or higher
- Laravel 9.0, 10.0, or 11.0
- Yeastar Gateway with AMI enabled
- Network connectivity to the Yeastar gateway
Installation
You can install the package via Composer:
The package will automatically register its service provider and facade.
Publishing Configuration
Publish the configuration file to customize the package settings:
This will create a config/yeastar-sms.php
file where you can configure your gateway settings.
Configuration
Environment Variables
Add the following environment variables to your .env
file:
Multiple Gateway Support
You can configure multiple gateways for different environments:
AMI Configuration on Yeastar
Ensure that AMI is enabled on your Yeastar gateway:
- Log into your Yeastar web interface
- Go to Settings โ System โ AMI
- Enable AMI and configure a user with SMS sending permissions
- Note the port number (default is 5038)
Usage
Basic Usage with Facade
Manual Connection Configuration
Dependency Injection
Using Different Gateway Configurations
Bulk SMS Sending
Artisan Command
The package includes an example Artisan command for sending SMS from the command line:
To use this command, copy the example from examples/ArtisanCommand.php
to your app/Console/Commands/
directory.
API Reference
YeastarSms Methods
setConnection(string $host, string $username, string $secret): void
Configure the gateway connection parameters.
$host
- Gateway hostname and port (e.g., "192.168.1.1:5038")$username
- AMI username$secret
- AMI secret/password
sendSms(int $port, string $destination, string $message, ?string $id = null): bool
Send an SMS message via the gateway.
$port
- GSM port number (0-based, will be converted to 1-based for gateway)$destination
- Phone number in E.164 format (e.g., "+1234567890")$message
- SMS message content (max 160 characters recommended)$id
- Optional SMS ID for tracking (auto-generated if not provided)
Returns true
on success, throws YeastarSmsException
on failure.
getConnection(): ?array
Get the current connection configuration (with secret hidden).
setTimeout(int $timeout): self
Set connection timeout in seconds (default: 30).
setReadTimeout(int $readTimeout): self
Set read timeout in seconds (default: 5).
Exception Handling
The package throws YeastarSmsException
for various error conditions:
Configuration Reference
The package configuration file (config/yeastar-sms.php
) includes:
Testing
Run the package tests:
Run tests with coverage:
Troubleshooting
Common Issues
-
Connection Failed
- Verify gateway hostname and port
- Check network connectivity
- Ensure firewall allows connection to AMI port (default 5038)
-
Authentication Failed
- Verify username and secret
- Check if AMI is enabled on the gateway
- Ensure user has proper permissions
-
SMS Command Failed
- Check if GSM module is properly configured
- Verify SIM card balance and network registration
- Ensure correct port number
- Timeout Errors
- Increase timeout values in configuration
- Check network latency
- Verify gateway is responsive
Debugging
Enable logging to see detailed information about SMS sending:
This will log connection attempts, authentication, and SMS sending details.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Security Vulnerabilities
If you discover a security vulnerability, please send an e-mail to the package maintainer. All security vulnerabilities will be promptly addressed.
Credits
- Andrej Ro
- All Contributors
This package is based on the Go implementation at yeastartgsms.
License
The MIT License (MIT). Please see License File for more information.
Changelog
Please see CHANGELOG.md for more information on what has changed recently.
Related Projects
- yeastartgsms - Original Go implementation
- Laravel SMS - Multi-provider SMS package for Laravel
Support
- ๐ Documentation
- ๐ Issue Tracker
- ๐ฌ Discussions
Made with โค๏ธ for the Laravel community
All versions of yeastar-gsm-laravel with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/contracts Version ^9.0|^10.0|^11.0|^12.0