定制 seravo/php-seravo-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

seravo/php-seravo-api

最新稳定版本:v1.1.1

Composer 安装命令:

composer require seravo/php-seravo-api

包简介

PHP Library for Seravo API

README 文档

README

PHP Seravo API

A simple, object-oriented wrapper for the Seravo API, written in PHP.

Getting Started

API credentials are required to use the service. For more information and to request API credentials, please visit our website or contact help@seravo.com directly.

Requirements

  • PHP >= 8.2
  • PHP XML extension (php-xml)
  • ext-curl PHP cURL extension
  • ext-json PHP JSON extension
  • ext-mbstring PHP Multibyte String extension

Installation

Clone the project:

HTTPS

git clone https://github.com/Seravo/php-seravo-api.git

SSH

git clone git@github.com:Seravo/php-seravo-api.git

Install composer dependencies:

composer install

The package uses PSR-4 autoloader for class autoloading. Activate autoloading by requiring the Composer autoloader (Note the path to the vendor directory is relative to your project):

require 'vendor/autoload.php';

Environment Variables

The following environment variables are required to be set before using the library:

  • SERAVO_API_CLIENT_ID
  • SERAVO_API_SECRET

Optionally, you may pass these environment variables as well:

  • SERAVO_ENVIRONMENT
    • Defines the API environment (testing, staging, production) to be used. Defaults to production if omitted from .env and/or constructor.

These values must be set in the /.env file. See .env.example.

Basic Usage

See the examples directory for more detailed information about how to use the library.

Initializing the Client

To initialize the SeravoAPI client, instantiate the class with valid credentials and authenticate:

<?php

use Seravo\SeravoApi\SeravoAPI;

require_once 'vendor/autoload.php';

// Initialize client
$api = new SeravoAPI(
    clientId: 'your-client-id',
    secret: 'your-client-secret'
);

// Authenticate with given credentials
$api->authenticate();

Public API

Get Single Plan

Return a single Plan by ID:

<?php

use Seravo\SeravoApi\SeravoAPI;

require_once 'vendor/autoload.php';

$api = new SeravoAPI(
    clientId: 'your-client-id',
    secret: 'your-client-secret'
);

$api->authenticate();

$plan = $api->public->plans()->getById(id: 'plan-id');
var_dump($plan);

Order API

Get Single Order

Return a single Order by ID:

<?php

require_once 'vendor/autoload.php';

use Seravo\SeravoApi\SeravoAPI;

$api = new SeravoAPI(
    clientId: 'your-client-id',
    secret: 'your-client-secret'
);

$api->authenticate();

$order = $api->order->orders()->getById(id: 'your-order-id');
var_dump($order);
Create New Order

Create a new Order:

<?php

require_once 'vendor/autoload.php';

use Seravo\SeravoApi\SeravoAPI;
use Seravo\SeravoApi\Apis\Order\Request\Order\CreateOrderRequest;
use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Billing\PaperInvoice;
use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Company;
use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Contact;
use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Mail;
use Seravo\SeravoApi\Apis\Order\Response\Order\Domain;

$billing = new PaperInvoice(
    contact_email: 'john@doe.com',
    contact_name: 'John Doe',
    contact_phone: '0401234567',
    address: 'Testikatu 1',
    city: 'Helsinki',
    postal: '00100',
    name: 'John Doe'
);

$createOrderRequest = new CreateOrderRequest(
    accept_service_terms: true,
    domains: [ new Domain(name: 'mydomainexample123.fi', primary: true) ],
    contact: new Contact(email: 'john@doe.com', name: 'John Doe', phone: '0401234567'),
    migration: false,
    order_language: 'fi', // 'fi', 'en_US', 'sv_SE'
    order_trial_period: 0,
    site_location: 'FI',
    price_data: 'd289afc7-b02e-44b5-918b-da66aa3d8858',
    billing: $billing,
    company: new Company(id: '1', name: 'John Doe'),
    mail: new Mail(option: '1'),
);

$api = new SeravoAPI(
    clientId: 'your-client-id',
    secret: 'your-client-secret'
);

$api->authenticate();

try {
    $result = $api->order->orders()->create($createOrderRequest);
    var_dump($result);
} catch (\Exception $exception) {
    var_dump($exception);
}

Documentation

See our documentation for Order Module API & Public Module API.

License

This project is licensed under the MIT License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固