The Local Class is your connector's entry point. It implements LocalClassInterface and provides configuration, initialization, and metadata for your connector.
Important: Splash always looks for the class Splash\Local\Local to initialize your connector. This namespace and class name are mandatory.
<?php
namespace Splash\Local;
use ArrayObject;
use Splash\Core\Interfaces\Local\LocalClassInterface;
class Local implements LocalClassInterface
{
/**
* Return connection parameters
*/
public function parameters(): array
{
return array(
"WsIdentifier" => "your-server-id",
"WsEncryptionKey" => "your-encryption-key",
);
}
/**
* Include required files
*/
public function includes(): bool
{
// Load your application bootstrap if needed
return true;
}
/**
* Run self-test validations
*/
public function selfTest(): bool
{
// Validate your configuration
// Use Splash::log() to report errors
return true;
}
/**
* Provide server information
*/
public function informations(ArrayObject $informations): ArrayObject
{
//====================================================================//
// Company
$informations->company = "Your Company";
$informations->address = "123 Main Street";
$informations->zip = "12345";
$informations->town = "Paris";
$informations->country = "France";
$informations->www = "https://your-website.com";
$informations->email = "contact@your-website.com";
$informations->phone = "+33 1 23 45 67 89";
//====================================================================//
// Server
$informations->servertype = "Your Application Name";
$informations->serverurl = "https://your-app.com";
$informations->moduleversion = "1.0.0";
return $informations;
}
}
This method must fully boot your application when Splash receives an API call. Splash has no knowledge of your system, so includes() is responsible for initializing everything: autoloader, database connection, services, etc.
use Splash\Core\Client\Splash;
public function includes(): bool
{
//====================================================================//
// Boot your application
require_once '/path/to/app/bootstrap.php';
return true;
}
You can differentiate between client and server mode using Splash::isServerMode():
use Splash\Core\Client\Splash;
public function includes(): bool
{
//====================================================================//
// When Library is called in SERVER mode
// i.e. API call from Splash Cloud (incoming sync)
//====================================================================//
if (Splash::isServerMode()) {
// Full initialization: autoloader, database, services, etc.
require_once '/path/to/app/bootstrap.php';
}
//====================================================================//
// When Library is called in CLIENT mode
// i.e. API call from your application (outgoing sync)
//====================================================================//
if (!Splash::isServerMode()) {
// Your app is already booted
// Minimal initialization if needed
}
//====================================================================//
// When Library is called in BOTH client & server mode
//====================================================================//
// Load additional Splash-specific resources here
return true;
}
Returns connection credentials and optional settings. Mandatory values are provided by Splash when you create a server in your dashboard.
| Parameter | Description |
|---|---|
WsIdentifier |
Your server unique identifier |
WsEncryptionKey |
Encryption key for secure communication |
Note: In production, these values are provided by Splash when you create a server in your dashboard. You don't define them yourself.
public function parameters(): array
{
return array(
"WsIdentifier" => "your-server-id",
"WsEncryptionKey" => "your-encryption-key",
);
}
You can also use environment variables. Splash automatically detects SPLASH_CONNEXION:
SPLASH_CONNEXION="https://your-server-id:your-encryption-key@proxy.splashsync.com/ws/soap"
With this env variable set, your parameters() can return an empty array:
public function parameters(): array
{
return array();
}
| Parameter | Default | Description |
|---|---|---|
DefaultLanguage |
en_US |
Language code for translations (e.g., fr_FR) |
SmartNotify |
false |
Only show warnings & errors on commit notifications |
| Parameter | Default | Description |
|---|---|---|
WsHost |
proxy.splashsync.com/ws/soap |
Splash API server URL |
WsTimeout |
30 |
Request timeout in seconds |
WsPostCommit |
true |
Intelligent Commit: send commits at end of request (set false to disable) |
ExtensionsPath |
[] |
List of paths to search for extensions (e.g., ["my-app/splash/extensions"]) |
Configurator |
- | Custom configurator class (must implement ConfiguratorInterface) |
ConfiguratorPath |
local/configuration.json |
Path to JSON config file (alternative to Configurator class) |
localname |
- | Force client name displayed in logs |
Validates your connector configuration. Called during server connection tests and results are displayed in your Splash dashboard.
Use Splash::log() to report errors and warnings:
use Splash\Core\Client\Splash;
public function selfTest(): bool
{
//====================================================================//
// Check database connection
if (!$this->checkDatabase()) {
Splash::log()->err("Database connection failed");
return false;
}
//====================================================================//
// Check required configuration
if (empty($this->getApiKey())) {
Splash::log()->err("API key not configured");
return false;
}
//====================================================================//
// Non-blocking warning
if (!$this->isCacheEnabled()) {
Splash::log()->war("Cache is disabled, performance may be affected");
}
return true;
}
Provides metadata displayed in your Splash dashboard server profile.
Since includes() was called before, your application is fully booted. You can fetch information directly from your app:
public function informations(ArrayObject $informations): ArrayObject
{
//====================================================================//
// Fetch company info from your application
$company = MyApp::getCompany();
//====================================================================//
// Company
$informations->company = $company->getName();
$informations->address = $company->getAddress();
$informations->zip = $company->getZipCode();
$informations->town = $company->getCity();
$informations->country = $company->getCountry();
$informations->www = $company->getWebsite();
$informations->email = $company->getEmail();
$informations->phone = $company->getPhone();
//====================================================================//
// Server
$informations->servertype = "My Application";
$informations->serverurl = MyApp::getUrl();
$informations->moduleversion = "1.0.0";
return $informations;
}
| Field | Description |
|---|---|
company |
Company name |
address |
Street address |
zip |
Postal code |
town |
City |
country |
Country |
www |
Website URL |
email |
Contact email |
phone |
Phone number |
| Field | Description |
|---|---|
servertype |
Your application name |
serverurl |
Application URL |
moduleversion |
Your connector version |
| Field | Description |
|---|---|
icoraw |
Icon as base64 encoded string |
logourl |
URL to your application logo |
Define different test configurations for your connector. Called during test sequences initialization.
$name is null or "List": return an array of available sequence names$name is a sequence name: set up that sequence and return an empty arraypublic function testSequences(?string $name = null): array
{
switch ($name) {
//====================================================================//
// Setup "Basic" test sequence
case "Basic":
MyApp::setupBasicTestConfig();
return array();
//====================================================================//
// Setup "Advanced" test sequence
case "Advanced":
MyApp::setupAdvancedTestConfig();
return array();
//====================================================================//
// List available sequences
default:
case "List":
return array("Basic", "Advanced");
}
}
Override general test settings to adjust to your local system.
public function testParameters(): array
{
return array(
//====================================================================//
// Override default test settings
"NumberOfItems" => 5,
"ReadDelay" => 100,
);
}
Create your first Object.
How can I help you explore Laravel packages today?