PHPackages                             eugenefvdm/api-collection - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. eugenefvdm/api-collection

Abandoned → [eugenefvdm/api-framework](/?search=eugenefvdm%2Fapi-framework)Library[API Development](/categories/api)

eugenefvdm/api-collection
=========================

APIs for various services

v0.12(1y ago)022[3 issues](https://github.com/eugenefvdm/api-collection/issues)MITPHPPHP ^8.1CI passing

Since Mar 21Pushed 2w ago1 watchersCompare

[ Source](https://github.com/eugenefvdm/api-collection)[ Packagist](https://packagist.org/packages/eugenefvdm/api-collection)[ Docs](https://github.com/eugenefvdm/api)[ RSS](/packages/eugenefvdm-api-collection/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (9)Versions (13)Used By (0)

API Framework
=============

[](#api-framework)

[![Tests](https://github.com/eugenefvdm/api-framework/actions/workflows/tests.yml/badge.svg)](https://github.com/eugenefvdm/api-framework/actions/workflows/tests.yml)[![Larastan](https://github.com/eugenefvdm/api-framework/actions/workflows/larastan.yml/badge.svg)](https://github.com/eugenefvdm/api-framework/actions/workflows/larastan.yml)[![Downloads](https://camo.githubusercontent.com/dbba248fe83b373e172e4d1ce0cfb7a14ceff92530d4a0b026d9b3b190f746e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f657567656e656676646d2f6170692d6672616d65776f726b2e737667)](https://packagist.org/packages/eugenefvdm/api-framework)

Another day, another API.

A set of Laravel API service providers.

1. BulkSMS
2. Discord
3. DNS
4. Fail2ban
5. Hello Peter
6. Slack
7. Tail
8. Telegram
9. WHM/cPanel
10. WHMCS
11. X (Twitter)
12. ZADomains

Installation
------------

[](#installation)

```
composer require eugenefvdm/api-framework
```

Publish the configuration file
------------------------------

[](#publish-the-configuration-file)

```
php artisan vendor:publish --provider="Eugenefvdm\Api\ApiServiceProvider" --tag="config"
```

Contents of `config/api.php`
----------------------------

[](#contents-of-configapiphp)

```
return [
    'cpanel' => [
        'username' => env('CPANEL_USERNAME'),
        'password' => env('CPANEL_PASSWORD'),
        'server' => env('CPANEL_SERVER'),
    ],

    'bulksms' => [
        'username' => env('BULKSMS_USERNAME'),
        'password' => env('BULKSMS_PASSWORD'),
        'encoding' => env('BULKSMS_ENCODING', '7bit'),
    ],

    'discord' => [
        'bot_token' => env('DISCORD_BOT_TOKEN'),
    ],

    'hellopeter' => [
        'api_key' => env('HELLOPETER_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'),
    ],

    // Use either the API or the database credentials or both
    'whmcs' => [
        'url' => env('WHMCS_URL'),
        'api_identifier' => env('WHMCS_API_IDENTIFIER'),
        'api_secret' => env('WHMCS_API_SECRET'),
        'limitnum' => env('WHMCS_LIMITNUM'),
    ],

    'x' => [
        'bearer_token' => env('X_BEARER_TOKEN'),
        // OAuth 1.0a user-context credentials, only required for posting tweets
        'consumer_key' => env('X_CONSUMER_KEY'),
        'consumer_secret' => env('X_CONSUMER_SECRET'),
        'access_token' => env('X_ACCESS_TOKEN'),
        'access_token_secret' => env('X_ACCESS_TOKEN_SECRET'),
    ],

    'zadomains' => [
        'username' => env('ZADOMAINS_USERNAME'),
        'password' => env('ZADOMAINS_PASSWORD'),
    ],
];
```

Usage
-----

[](#usage)

Precede access by the facade namespace, e.g.

```
use Eugenefvdm\Api\Facades\Bulksms;
Bulksms::sendSms("Hello SMS!", ["27825551231"]);
```

### BulkSMS Unicode and custom wording

[](#bulksms-unicode-and-custom-wording)

BulkSMS defaults to 7-bit messages. To make the Laravel facade send Unicode content like emoji, configure the encoding:

```
BULKSMS_ENCODING=16bit
```

Then keep using the facade as usual:

```
use Eugenefvdm\Api\Facades\Bulksms;

Bulksms::sendSms("Hello ⭐️", ["27825551232"]);
```

For one-off Unicode sends, use the convenience method or a temporary encoding:

```
use Eugenefvdm\Api\Facades\Bulksms;

Bulksms::sendUnicodeSms("Hello ⭐️", ["27825551232"]);
Bulksms::encoding("16bit")->sendSms("Hello ⭐️", ["27825551232"]);
```

Supported encodings are `7bit`, `16bit`, and `auto`. The `auto` option sends GSM-safe text as 7-bit and switches to 16-bit when Unicode is needed.

```
BULKSMS_ENCODING=auto
```

For generic message length handling, use `SmsText`:

```
use Eugenefvdm\Api\SmsText;

$message = SmsText::limit("Hello ⭐️", encoding: "16bit", parts: 1);
```

The BulkSMS client stays generic: it sends the message you give it and handles the transport encoding. If an app needs specific SMS wording, prepare that message first and then pass it to the generic sender.

For example, Hellopeter review notifications can use the included formatter before sending:

```
use Eugenefvdm\Api\Facades\Bulksms;
use Eugenefvdm\Api\HellopeterReviewSms;

$message = HellopeterReviewSms::shorten(
    "You received a ⭐️⭐️⭐️⭐️⭐️ review by Eugene at Hellopeter. Please reply ASAP."
);

Bulksms::sendUnicodeSms($message, ["27825551233"]);
```

Here is a list of all the API calls:

```
Bulksms::sendSms("Hello SMS!", ["27825551234","27825551235"]);

$discordUser = Discord::user("123456789012345678");

$nsRecords = Dns::NS("example.com");

$digMxRecords = Dns::MX("example.com"); // Use `dig` to get MX records
$nativeMxRecords = Dns::MX("example.com", false); // Use PHP native to get MX recorss

Fail2ban:setServer("username", "hostname", 22); // Port is optional
$firstEntry = Fail2ban::first("192.168.1.1");
$lastEntry = Fail2ban::last("192.168.1.1");

$unrepliedReviews = Hellopeter::unrepliedReviews();

Slack::sendText("Hello Slack!");

Tail::setServer("username", "hostname", 22);
$logEntry = Tail::last("/var/log/mail.log", "user@example.com", 1); // 1 = optional number of log entries to return

Telegram::sendMessage("Hi Telegram!");

$bandwidth = Whm::bandwidth();
Whm::suspendEmail('cPanel_username', 'user@example.com');
Whm::unsuspendEmail('cPanel_username', 'user@example.com');
$whitelist = Whm::cphulkWhitelist();
$blacklist = Whm::cphulkBlacklist();
Whm::createEmail('cpanel_username', 'user@example.com', 'password');
Whm::deleteEmail('cpanel_username', 'user@example.com');
$password = Whm::generatePassword(); // Generate a random 12 character password

Whmcs::addClient([]); // See `addClient()` in `Whmcs.php` for required parameters
// Laravel model wrappers:
Whmcs::createClientGroup($name, $colour = '#ffffff');
Whmcs::createCustomClientField($name, $type = 'text');

$userId = X::userId("x_username");
$tweets = X::tweets($userId['data']['id'], 5);
$userWithLimits = X::userWithRateLimits("x_username");
$posted = X::tweet("Hello X!"); // Requires OAuth 1.0a credentials (write access)

$registrant = Zadomains::registrant("example.co.za");
```

Optional services
-----------------

[](#optional-services)

WHM and cPanel are optional — the singletons are always registered but credentials are only required when an API call is made. Use `isConfigured()` to check before calling:

```
if (Whm::isConfigured()) {
    Whm::createEmail('cpanel_username', 'user@example.com', 'password');
}

if (Cpanel::isConfigured()) {
    Cpanel::createEmail('user@example.com', 'password');
}
```

### Required `.env` keys for WHM

[](#required-env-keys-for-whm)

```
WHM_USERNAME=root
WHM_PASSWORD=your-password-or-api-token
WHM_SERVER=https://your-server.example.com:2087
```

Testing
-------

[](#testing)

```
composer test
```

Design philosophy
-----------------

[](#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 framework 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
-----------------------

[](#contribution-guidelines)

New contributions are super welcome!

1. Fork the repository
2. Create a new branch for your changes (`git checkout -b feature/amazing-api`)
3. Make your changes
4. Run the tests (`./vendor/bin/pest`)
5. Run Larastan (`./vendor/bin/phpstan analyse`)
6. Submit a pull request

When adding a new API, it has to be added to both ApiServiceProvider, ApiManager and a Facade.

### Code Style &amp; Standards

[](#code-style--standards)

- Pint is installed, so simply run `vendor/bin/pint` to 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, also don't capatalize, e.g., `Hellopeter`
        - Getters should not be prepended by "get", e.g. use `message()` instead of `getMessage()`
        - Setters should be prepended by "set", e.g. `setServer()`
    - All API responses should follow this format:

```
// Success response
[
    "status" => "success",
    "output" => $output,
]
// Error response
[
    "status" => "error",
    "output" => "Error message here",
]
```

### Need Help?

[](#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.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance53

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

12

Last Release

463d ago

PHP version history (2 changes)v0.1PHP &gt;=7.4

v0.2PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/932743c076390240ecdefe58dc5f81b60cb5fe9ed38b3bead0541f640a7bb2a8?d=identicon)[eugenevdm](/maintainers/eugenevdm)

---

Top Contributors

[![eugenefvdm](https://avatars.githubusercontent.com/u/1836436?v=4)](https://github.com/eugenefvdm "eugenefvdm (89 commits)")

---

Tags

phpapilaravelslacktailtelegramdiscordapisbulksmsfail2banhellopeterzadomains

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/eugenefvdm-api-collection/health.svg)

```
[![Health](https://phpackages.com/badges/eugenefvdm-api-collection/health.svg)](https://phpackages.com/packages/eugenefvdm-api-collection)
```

###  Alternatives

[resend/resend-laravel

Resend for Laravel

1222.7M9](/packages/resend-resend-laravel)[wayofdev/laravel-symfony-serializer

📦 Laravel wrapper around Symfony Serializer.

2117.7k](/packages/wayofdev-laravel-symfony-serializer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
