A modern, elegant Laravel SDK for the Ortto Customer Data Platform API. Built on top of Saloon, this package provides a fluent interface to interact with Ortto's REST API.
- Full Ortto API coverage (People, Activities, Campaigns, and more)
- Built with Saloon for robust HTTP communication
- Laravel integration via service provider
- Type-safe requests and responses
- Comprehensive test coverage
- Modern PHP 8.4+ syntax
- PHP 8.4 or higher
- Laravel 10.x or 11.x
Install the package via Composer:
composer require phpdevkits/ortto-sdkPublish the configuration file:
php artisan vendor:publish --provider="PhpDevKits\Ortto\OrttoServiceProvider"Add your Ortto API credentials to your .env file:
ORTTO_API_KEY=your-api-key-here
ORTTO_REGION=ap3 # Options: ap3 (default), au, euThe configuration file will be published to config/ortto.php:
return [
'api_key' => env('ORTTO_API_KEY'),
'region' => env('ORTTO_REGION', 'ap3'),
];Ortto uses region-specific endpoints:
- Default (AP3):
https://api.ap3api.com/- For most Ortto users - Australia:
https://api.au1api.com/- For AU region instances - Europe:
https://api.eu1api.com/- For EU region instances
use PhpDevKits\Ortto\Facades\Ortto;
// Create or update a person
Ortto::people()->merge([
'email' => 'user@example.com',
'first_name' => 'John',
'last_name' => 'Doe',
]);
// Get a person by email
$person = Ortto::people()->get('user@example.com');
// Delete a person
Ortto::people()->delete('user@example.com');// Track a custom activity
Ortto::activities()->create([
'email' => 'user@example.com',
'activity_name' => 'product_viewed',
'attributes' => [
'product_id' => '12345',
'product_name' => 'Premium Widget',
],
]);// Send a campaign email
Ortto::campaigns()->send([
'campaign_id' => 'your-campaign-id',
'recipients' => [
['email' => 'user@example.com'],
],
]);Browse the docs/ directory for detailed documentation:
- Introduction - Learn about Ortto SDK and its features
- Installation Guide - Get set up in minutes
- Testing Overview - Testing with Pest and Lawman
- Architecture Tests - Validate Saloon architecture with Lawman
- Mocking - Mock API responses with Saloon MockClient
For detailed information about Ortto's API endpoints and parameters, refer to the Ortto API Documentation.
Clone the repository and install dependencies:
git clone https://github.com/phpdevkits/ortto-sdk.git
cd ortto-sdk
composer installKeep a modern codebase with Pint:
composer lintRun refactors using Rector:
composer refactorRun static analysis using PHPStan:
composer test:typesRun unit tests using PEST:
composer test:unitRun the entire test suite:
composer testThe package includes comprehensive test coverage using PEST and Lawman for architecture testing:
composer testLearn more about testing in our Testing Documentation.
Please see CHANGELOG for recent changes.
Please see CONTRIBUTING for details.
If you discover any security-related issues, please email security@example.com instead of using the issue tracker.
This package is built with modern PHP tools and frameworks:
- Laravel - The PHP framework for web artisans
- Saloon - Build beautiful API integrations
- Pest PHP - An elegant PHP testing framework
- Lawman - Architecture testing for Saloon
- PHPStan - PHP static analysis tool
- Laravel Pint - PHP code style fixer
- Rector - Instant upgrades and automated refactoring
Special thanks to:
- Ortto for their Customer Data Platform API
- Ortto API Documentation
The MIT License (MIT). Please see License File for more information.