PHP code example of eugenefvdm / api-collection

1. Go to this page and download the library: Download eugenefvdm/api-collection library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eugenefvdm / api-collection example snippets


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

Bulksms::sendSms("Hello SMS!", ["27600000001","2760000000"]);

$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", "[email protected]", 1); // 1 = optional number of log entries to return

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

$bandwidth = Whm::bandwidth();
Whm::suspendEmail('cPanel_username', '[email protected]');
Whm::unsuspendEmail('cPanel_username', '[email protected]');
$whitelist = Whm::cphulkWhitelist();
$blacklist = Whm::cphulkBlacklist();
Whm::createEmail('cpanel_username', '[email protected]', 'password');
Whm::deleteEmail('cpanel_username', '[email protected]');
$password = Whm::generatePassword(); // Generate a random 12 character password

Whmcs::addClient([]); // See `addClient()` in `Whmcs.php` for 

if (Whm::isConfigured()) {
    Whm::createEmail('cpanel_username', '[email protected]', 'password');
}

if (Cpanel::isConfigured()) {
    Cpanel::createEmail('[email protected]', 'password');
}

// Success response
[
    "status" => "success",
    "output" => $output,
]
// Error response
[
    "status" => "error",
    "output" => "Error message here",
]
bash
php artisan vendor:publish --provider="Eugenefvdm\Api\ApiServiceProvider" --tag="config"