承接 smart-dato/isp-config 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

smart-dato/isp-config

最新稳定版本:v0.0.2

Composer 安装命令:

composer require smart-dato/isp-config

包简介

ISPConfig SDK for Laravel

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel SDK for the ISPConfig SOAP API. Provides a fluent, resource-oriented interface to manage clients, websites, mail, DNS, databases, and more.

Requirements

  • PHP 8.4+
  • Laravel 11, 12, or 13
  • PHP SOAP extension (ext-soap)

Installation

composer require smart-dato/isp-config

Publish the config file:

php artisan vendor:publish --tag="isp-config-config"

Add your ISPConfig credentials to .env:

ISPCONFIG_HOST=your-server.example.com
ISPCONFIG_PORT=8080
ISPCONFIG_USERNAME=your-remote-user
ISPCONFIG_PASSWORD=your-password
ISPCONFIG_VERIFY_SSL=true
ISPCONFIG_TIMEOUT=30

Note: The remote user must be created in ISPConfig under System > Remote Users with the appropriate permission checkboxes enabled.

Usage

Via Facade

use SmartDato\IspConfig\Facades\IspConfig;

// Clients
$clients = IspConfig::client()->getAll();
$client = IspConfig::client()->get(1);
$id = IspConfig::client()->add(0, [
    'company_name' => 'Acme Corp',
    'contact_name' => 'John Doe',
    'username' => 'acme',
    'password' => 'secret',
    // ...
]);

// Websites
$siteId = IspConfig::sites()->webDomain()->add(1, [
    'server_id' => 1,
    'domain' => 'example.com',
    'php' => 'php-fpm',
    'active' => 'y',
    // ...
]);

// Mail
$mailUserId = IspConfig::mail()->user()->add(1, [
    'server_id' => 1,
    'email' => 'joe@example.com',
    'password' => 'secret',
    // ...
]);

// DNS
$recordId = IspConfig::dns()->a()->add(1, [
    'server_id' => 1,
    'zone' => 5,
    'name' => 'www',
    'data' => '93.184.216.34',
    'ttl' => '3600',
    'active' => 'y',
]);

// Databases
$dbId = IspConfig::database()->add(1, [
    'server_id' => 1,
    'type' => 'mysql',
    'database_name' => 'mydb',
    'database_user_id' => 1,
    'active' => 'y',
]);

Via Dependency Injection

use SmartDato\IspConfig\IspConfig;

final class ServerController
{
    public function __construct(
        private readonly IspConfig $ispConfig,
    ) {}

    public function index(): array
    {
        return $this->ispConfig->server()->getAll();
    }
}

Ad-hoc Connections

Create a standalone client without relying on config — useful for multi-server setups or dynamic credentials:

use SmartDato\IspConfig\IspConfig;

$isp = IspConfig::make([
    'host' => '192.168.1.100',
    'port' => 8080,
    'username' => 'admin',
    'password' => 'secret',
    'verify_ssl' => false,
    'timeout' => 60,
]);

$clients = $isp->client()->getAll();

Available Resources

Accessor Sub-resources API prefix
client() client_*
server() server_*
sites() webDomain(), subdomain(), aliasDomain(), vhostSubdomain(), vhostAliasDomain(), folder(), folderUser() sites_web_*
mail() domain(), user(), alias(), forward(), aliasDomain(), filter(), userFilter(), catchall(), fetchmail(), transport(), relayRecipient(), policy(), blacklist(), whitelist(), spamfilterUser(), spamfilterBlacklist(), spamfilterWhitelist() mail_*
dns() zone(), a(), aaaa(), cname(), mx(), ns(), txt(), srv(), ptr(), alias(), hinfo(), rp() dns_*
database() user() sites_database_*
ftp() sites_ftp_user_*
shell() sites_shell_user_*
cron() sites_cron_*

Most resources provide add(), get(), update(), and delete() methods. Parameter array keys mirror the ISPConfig database column names — refer to the ISPConfig API documentation for available fields.

Session Management

Sessions are managed automatically:

  • Auto-login — authenticates lazily on the first API call
  • Auto-logout — logs out when the Laravel request terminates
  • Session re-auth — detects expired sessions and re-authenticates transparently

Raw API Calls

For methods not yet wrapped in a resource class:

$result = IspConfig::call('some_api_method', $arg1, $arg2);

// List all available API methods
$methods = IspConfig::getFunctionList();

Testing

The package provides a FakeConnector for testing, following Laravel's Http::fake() pattern:

use SmartDato\IspConfig\Facades\IspConfig;

$fake = IspConfig::fake();

// Stub responses
$fake->stub('client_get', ['id' => 1, 'company_name' => 'Acme']);
$fake->stub('mail_user_add', 15);

// Call your application code
$client = IspConfig::client()->get(1);
$mailUserId = IspConfig::mail()->user()->add(1, ['email' => 'joe@test.com']);

// Assert calls were made
$fake->assertCalled('client_get');
$fake->assertCalled('mail_user_add', fn (array $params) => $params[2]['email'] === 'joe@test.com');
$fake->assertNotCalled('client_delete');
$fake->assertCallCount('client_get', 1);

Run the package test suite:

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固