yohacodes/afro-msg-php
Composer 安装命令:
composer require yohacodes/afro-msg-php
包简介
A modern, PSR-compliant PHP SDK for easily integrating with the Afromessage API. Includes support for verification, messaging, and more.
README 文档
README
AfroMsg is a modern, extensible PHP SDK for integrating with the Afromessage API. It supports token-based authentication, code verification, message sending, and is fully PSR-compliant. Ideal for Laravel and any PHP-based backend.
🚀 Features
- ✅ Clean and simple API for SMS verification and messaging
- ✅ PSR-4 & PSR-12 compliant structure
- ✅ Laravel-ready (via optional ServiceProvider)
- ✅ Extensible via interfaces (use Guzzle, Curl, or any HTTP client)
- ✅ Fully tested with PHPUnit
- ✅ IDE-friendly with stubs and PHPDocs
📦 Installation
Install the SDK using Composer:
composer require yohacodes/afro-msg-php
⚙️ Configuration
Create a .env file or define your token manually:
AFROMESSAGE_API_TOKEN=your_api_token
Alternatively, configure directly in code:
$client = new \AfroMsg\Http\GuzzleAfromessageClient('your_api_token');
✨ Quick Start
🔍 Verify Code
use AfroMsg\Http\GuzzleAfromessageClient; $client = new GuzzleAfromessageClient('your_api_token'); $response = $client->verifyCode('+251912345678', '123456'); if ($response['success']) { echo "Code verified!"; } else { echo "Verification failed."; }
🧱 Architecture
AfroMsg\
├── Contracts\ # Interfaces for HTTP clients
├── Http\ # Guzzle implementation (default)
├── Responses\ # Response wrappers
├── Exceptions\ # Custom exception classes
├── Support\ # Helper utilities
├── AfroMsg.php # Facade for simplified usage
└── stubs\ # IDE stubs and config templates
🧪 Testing
Run all unit and feature tests using:
vendor/bin/phpunit
We recommend using Mockery and Guzzle MockHandler for mocking API calls.
🧩 Extending
Create a custom client by implementing the interface:
namespace AfroMsg\Contracts; interface AfromessageClientInterface { public function verifyCode(string $to, string $code): array; }
You can then inject or bind your implementation as needed.
🎯 Laravel Integration (Optional)
For Laravel users, a service provider and config file can be published:
php artisan vendor:publish --provider="AfroMsg\AfromessageServiceProvider"
use AfroMsg\Facades\AfroMsg; AfroMsg::verifyCode('0912345678', '4567');
🧠 Roadmap
- Basic verify functionality
- SMS sending
- Delivery reports
- Balance check
- Notifications and webhooks
- Laravel package auto-discovery
🤝 Contributing
Contributions are welcome!
- Fork the repo
- Run
composer install - Create your feature branch (
git checkout -b feature/my-feature) - Commit your changes
- Push to the branch
- Create a new Pull Request
🛡 License
This package is open-sourced software licensed under the MIT license.
📞 Contact & Support
For questions or support, please open an issue or email support@yourdomain.com.
Crafted with ❤️ by Yohannes Z. (https://github.com/yohacode)
---
### ✅ Next Steps
If you'd like, I can:
- Generate this as a full GitHub-ready package
- Scaffold the full project structure as a `.zip`
- Add CI workflow (`.github/workflows/tests.yml`)
- Create Packagist metadata
Would you like the full structure generated?
yohacodes/afro-msg-php 适用场景与选型建议
yohacodes/afro-msg-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 05 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sms」 「messaging」 「php sdk」 「verification」 「afromessage」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 yohacodes/afro-msg-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yohacodes/afro-msg-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 yohacodes/afro-msg-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
PHP SDK for Mobile Message SMS API
Extensible library for building notifications and sending them via different delivery channels.
Azure service bus Transport
Official PHP client for NATS messaging system
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-30