seravo / php-seravo-api
PHP Library for Seravo API
Requires
- php: >=8.2
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- firebase/php-jwt: ^6.11
- json-mapper/json-mapper: ^2.22
- jumbojett/openid-connect-php: ^1.0
- php-http/client-common: ^2.7
- php-http/discovery: ^1.20
- php-http/httplug: ^2.4
- psr/http-message: ^2.0
- symfony/property-access: ^7.2
- symfony/serializer: ^7.2
Requires (Dev)
- guzzlehttp/guzzle: ^7.9
- mockery/mockery: ^1.6
- phpcompatibility/php-compatibility: ^9.3
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^11.3
- squizlabs/php_codesniffer: ^3.10
- symfony/var-dumper: ^7.1
- vlucas/phpdotenv: ^5.6
This package is auto-updated.
Last update: 2026-04-27 08:25:07 UTC
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_IDSERAVO_API_SECRET
Optionally, you may pass these environment variables as well:
SERAVO_ENVIRONMENT- Defines the API environment (
testing,staging,production) to be used. Defaults toproductionif omitted from.envand/or constructor.
- Defines the API environment (
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.