ossycodes/nigeriabulksms-php
Composer 安装命令:
composer require ossycodes/nigeriabulksms-php
包简介
Nigeriabulksms REST API client for PHP
README 文档
README
This repository contains the open source PHP client for Nigeriabulksms's API. Documentation can be found at: https://nigeriabulksms.com/sms-gateway-api-in-nigeria/
Requirements
- Sign up for a free Nigeriabulksms account
- after signing up, your username and password will be used for authenticating with the APIs
- Nigeriabulksms API client for PHP requires PHP >= 7.4.
Installation
Composer installation
- Download composer
- Run
composer require ossycodes/nigeriabulksms-php.
Manual installation
When you do not use Composer. You can git checkout or download this repository and include the Nigeriabulksms API client manually.
Usage
We have put some self-explanatory examples in the src/Examples directory, but here is a quick breakdown on how it works. First, you need to set up a Nigeriabulksms\Client. Be sure to replace YOUR_USERNAME and YOUR_PASSWORD with your real credentials.
require 'autoload.php'; $config = \Ossycodes\Nigeriabulksms\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD') ->setTimeout(10) //optional defaults to 10 ->setConnectionTimeout(2); //optional defaults to 2 $client = new \Ossycodes\Nigeriabulksms\Client($config);
That's easy enough. Now we can query the server for information. Lets use getting your balance overview as an example:
try { // Get your balance $balance = $client->balance->read(); var_dump($balance); } catch (\Ossycodes\Nigeriabulksms\Exceptions\AuthenticateException $e) { // That means that your username and/or password is incorrect echo 'invalid credentials'; } catch (\Ossycodes\Nigeriabulksms\Exceptions\BalanceException $e) { // That means that your balance is insufficient echo 'insufficient balance'; } catch (\Exception $e) { var_dump($e->getMessage()); }
Sending Text SMS Message
require_once(__DIR__ . '/../autoload.php'); $config = \Ossycodes\Nigeriabulksms\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD') ->setTimeout(10) //optional defaults to 10 ->setConnectionTimeout(2); //optional defaults to 2 $client = new \Ossycodes\Nigeriabulksms\Client($config); try { $message = new \Ossycodes\Nigeriabulksms\Objects\TextMessage(); $message->sender = 'YOUR_SENDER_NAME'; $message->recipients = '2342222222222'; $message->body = 'body of text message goes in here'; //should be less than 160 characters //send the text sms message $response = $client->message->send($message); var_dump($response); } catch (\Ossycodes\Nigeriabulksms\Exceptions\AuthenticateException $e) { // That means that your username and/or password is incorrect echo 'invalid credentials'; } catch (\Ossycodes\Nigeriabulksms\Exceptions\BalanceException $e) { // That means that your balance is insufficient echo 'insufficient balance'; } catch (\Ossycodes\Nigeriabulksms\Exceptions\RequestDeniedException $e) { // That means that you do not have permission to perform this action echo 'this action is not permitted'; } catch (\Exception $e) { var_dump($e->getMessage()); }
Documentation
Complete documentation, instructions, and examples are available at: https://nigeriabulksms.com/sms-gateway-api-in-nigeria/
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email osaigbovoemmanuel1@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
How do I say Thank you?
Please buy me a cup of coffee https://www.paypal.com/paypalme/osaigbovoemmanuel , Leave a star and follow me on Twitter .
ossycodes/nigeriabulksms-php 适用场景与选型建议
ossycodes/nigeriabulksms-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 172 次下载、GitHub Stars 达 5, 最近一次更新时间为 2023 年 09 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ossycodes」 「nigeriabulksms-php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ossycodes/nigeriabulksms-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ossycodes/nigeriabulksms-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 172
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 11
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-21