eugenefvdm/api-collection
最新稳定版本:v0.12
Composer 安装命令:
composer require eugenefvdm/api-collection
包简介
APIs for various services
关键字:
README 文档
README
Another day, another API.
A set of Laravel API service providers.
- BulkSMS
- Discord
- DNS
- Fail2ban
- Hello Peter
- Slack
- Tail
- Telegram
- WHM/cPanel
- X (Twitter)
- ZADomains
Installation
composer require eugenefvdm/api-collection
Publish the configuration file
php artisan vendor:publish --provider="Eugenefvdm\Api\ApiServiceProvider" --tag="config"
Contents of config/api.php
return [
'bulk_sms' => [
'username' => env('BULK_SMS_USERNAME'),
'password' => env('BULK_SMS_PASSWORD'),
],
'discord' => [
'bot_token' => env('DISCORD_BOT_TOKEN'),
],
'hello_peter' => [
'api_key' => env('HELLO_PETER_API_KEY'),
],
'slack' => [
'webhook_url' => env('SLACK_WEBHOOK_URL'),
],
'telegram' => [
'bot_token' => env('TELEGRAM_BOT_TOKEN'),
'chat_id' => env('TELEGRAM_CHAT_ID'),
],
'whm' => [
'username' => env('WHM_USERNAME'),
'password' => env('WHM_PASSWORD'),
'server' => env('WHM_SERVER', 'https://server.example.com:2087'),
],
'x' => [
'bearer_token' => env('X_BEARER_TOKEN'),
],
'za_domains' => [
'username' => env('ZA_DOMAINS_USERNAME'),
'password' => env('ZA_DOMAINS_PASSWORD'),
],
];
Usage
use Eugenefvdm\Api\Facades\Bulksms; $bulkSms = Bulksms::sendSms("Hello SMS!", ["27600000000"]); use Eugenefvdm\Api\Facades\Discord; $discord = Discord::user("123456789012345678"); use Eugenefvdm\Api\Facades\Dns; $nameservers = Dns::NS("example.com"); // Use PHP native use Eugenefvdm\Api\Facades\Dns; $nameservers = Dns::NS("example.com", true); // Use Dig use Eugenefvdm\Api\Facades\Fail2ban; Fail2ban:setServer("username", "hostname", 22); // Port is optional $firstFail2banEntry = Fail2ban::first("192.168.1.1"); $lastFail2banEntry = Fail2ban::last("192.168.1.1"); use Eugenefvdm\Api\Facades\Hellopeter; $hellopeterUnrepliedReviews = Hellopeter::unrepliedReviews(); use Eugenefvdm\Api\Facades\Slack; $textSendResult = Slack::sendText("Hello Slack!"); use Eugenefvdm\Api\Facades\Tail; Tail::setServer("username", "hostname", 22); $mailLogs = Tail::last("user@example.com", 1); // 1 = number of entries (optional) use Eugenefvdm\Api\Facades\Telegram; $messageSendResult = Telegram::sendMessage("Hi Telegram!"); use Eugenefvdm\Api\Facades\Whm; $whmBandwidth = Whm::bandwidth(); use Eugenefvdm\Api\Facades\X; $userId = X::userId("x_username"); $tweets = X::tweets($userId['data']['id'], 5); $userWithLimits = X::userWithRateLimits("x_username"); use Eugenefvdm\Api\Facades\Zadomains; $zadomainsRegistrant = Zadomains::registrant("example.co.za");
Testing
vendor/bin/pest
Design philosophy
APIs can be hard. Reading documentation is a drag. And what if you only want to use a few calls? Do you really have to learn everything? This library collection gives you the power of many APIs in one package. It's minimalist and uses Laravel's facades for easy access. Each call is tested using stubs which doubles as a handy reference.
Contribution Guidelines
New contributions are super welcome!
- Fork the repository
- Create a new branch for your changes (
git checkout -b feature/amazing-api) - Make your changes
- Run the tests (
./vendor/bin/pest) - Run Larastan (
./vendor/bin/phpstan analyse) - Submit a pull request
Code Style & Standards
- Pint is installed, so simply run
vendor/bin/pintto make your code clean - For new APIs and API calls:
- Add feature tests with stubs (see existing examples)
- Ensure stubs are redacted of sensitive information
- Follow the existing naming conventions:
- Capitalize only the first letter of API's name (e.g.,
BulkSms,Zadomains) - For compound names, remove also don't capatalize (e.g.,
Hellopeter) - Getters should not be prepended by "get" (e.g.,
message()instead ofgetMessage()) - Setter should be prepended by "set", e.g.
setServer()
- Capitalize only the first letter of API's name (e.g.,
- All API responses should follow this format:
// Success response [ "status" => "success", "output" => $output, ] // Error response [ "status" => "error", "output" => "Error message here", ]
Need Help?
If you have an idea for a new API or API call but don't have time to implement it, feel free to open a new issue to see if we can do an implementation.
eugenefvdm/api-collection 适用场景与选型建议
eugenefvdm/api-collection 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「laravel」 「tail」 「bulksms」 「apis」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 eugenefvdm/api-collection 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 eugenefvdm/api-collection 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 eugenefvdm/api-collection 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Alfabank REST API integration
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
Laravel package for Accurate Online API integration.
A lightweight plain-PHP framework for database-backed CRUD APIs.
bughq error tracking - PHP SDK
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-21