ziswapp / zenziva-client-api
Zenziva client api
Installs: 7 627
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: ^7.4|^8.0
- ext-json: *
- ext-simplexml: *
- illuminate/events: ^7.30|^8.40|^9.19
- illuminate/notifications: ^7.30|^8.40|^9.19
- illuminate/support: ^7.30|^8.40|^9.19
- nesbot/carbon: ^2.27
- symfony/http-client: ^4.4|^5.0|^6.0
Requires (Dev)
- phpunit/phpunit: ^8.0
- symplify/easy-coding-standard: ^9.4
- vimeo/psalm: ^4.8
README
ZenzivaClientApi
Ini adalah client api untuk zenziva sms gateway.
Move package to https://github.com/atfromhome/zenziva-client-api
Install
composer require ziswapp/zenziva-client-api
Penggunaan
<?php use Ziswapp\Zenziva\ClientFactory; use Symfony\Component\HttpClient\HttpClient; $url = ''; $key = ''; $secret = ''; $httpClient = HttpClient::create(); // Crete client $regular = ClientFactory::regular($httpClient, $key, $secret); // Regular client $masking = ClientFactory::masking($httpClient, $key, $secret); // Masking client $otp = ClientFactory::otp($httpClient, $key, $secret); // Masking with otp client $smsCenter = ClientFactory::center($httpClient, $key, $secret, $url); // SMS Center client // Alternative $regular = ClientFactory::make($httpClient, ClientFactory::TYPE_REGULAR, $key, $secret); // Regular client $masking = ClientFactory::make($httpClient, ClientFactory::TYPE_MASKING, $key, $secret); // Masking client $otp = ClientFactory::make($httpClient, ClientFactory::TYPE_MASKING_OTP, $key, $secret); // Masking with otp client $smsCenter = ClientFactory::make($httpClient, ClientFactory::TYPE_SMS_CENTER, $key, $secret, $url); // SMS Center client // Zenziva Regular Operation $httpClient = HttpClient::create(); $regular = ClientFactory::make($httpClient, ClientFactory::TYPE_REGULAR, $key, $secret); // Regular client $regular->send('081318788271', 'Sending notification.'); // Return array // Zenziva Masking Operation $httpClient = HttpClient::create(); $masking = ClientFactory::make($httpClient, ClientFactory::TYPE_MASKING, $key, $secret); // Masking client $masking->balance(); // Check balance return Credit object $masking->send('081318788271', 'Sending notification.'); // Return Outbox object $masking->setIsOtp(true); // Change to masking otp client // Zenziva SMS Center Operation $smsCenter = ClientFactory::make($httpClient, ClientFactory::TYPE_SMS_CENTER, $key, $secret, $url); // SMS Center client $smsCenter->balance(); // Check balance return Credit object, will be throw CreditExpiredException or CreditLimitException if balance is 0 and expired date < now $smsCenter->send('081318788271', 'Sending notification.'); // Return Outbox object $smsCenter->outbox(new DateTime(), new DateTime()); // Get outbox by date, return array Outbox object $smsCenter->inbox(new DateTime(), new DateTime()); // Get inbox by date, return array Inbox object $smsCenter->status('messageId'); // Get status sms by messageId, return Outbox object