datalinx / squalomail-php-sdk
PHP SDK for SqualoMail
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
Requires (Dev)
- jaschilz/php-coverage-badger: ^2.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-03-16 11:26:45 UTC
README
About
Disclaimer: This is not an official SDK.
With this package you can use the SqualoMail API in your PHP project.
See the changelog here.
Requirements
- PHP >= 7.4
- CURL and JSON PHP extensions
- Ubuntu is tested and supported, but should also work on Windows
Installing
Download it with composer:
composer require datalinx/squalomail-php-sdk
Usage
$api = new API('your API key here'); $request = new CreateRecipient($api); $request->email = 'john@example.com'; $request->name = 'John'; $request->surname = 'Doe'; try { $response = $request->send(); // Subscribed, see the CreateRecipientResponse class for details echo $response->getRecipient()->id; } catch (Exception $exception) { echo 'Oops, something went wrong: '. $exception->getMessage(); }
Requests implementation
All API endpoints are specified here.
However, only the following are implemented in this package currently.
Request | Notes |
---|---|
Create recipient | |
Get recipient | |
Get recipient's lists | See the GetRecipientLists class docblock for explanation. |
Update recipient | You can provide either the recipient ID or the email. If you provide both, the email address for the matching recipient ID will be updated. |
Delete recipient | You can delete recipients only by ID, so fetch the ID with a GetRecipient request first. |
Create list | |
Delete list | |
Get list | See the GetList::send() method docblock for the response data |
Get list recipients | Does not support pagination |
Get lists details | |
Subscribe by email | This works only for recipients that are already created. If re-subscribing, also set the "accept" parameter to "true". |
Unsubscribe by email | The "accept" attribute on the recipient is updated considering how you configured it in SqualoMail settings (Slovenian: "Po kliku na povezavo za odjavo naj prejemnika odjavi od"). You can also send a boolean here to force a change, but it will be ignored when the setting is set to the third option (Slovenian: "Prejemanja katerihkoli sporočil v prihodnje"). |
Contributing
If you have some suggestions how to make this package better, please open an issue or even better, submit a pull request.
Should you want to contribute, please see the development guidelines in the DataLinx PHP package template.
Changelog
All notable changes to this project are automatically documented in the CHANGELOG.md file using the release workflow, based on the release-please GitHub action.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
For all this to work, commit messages must follow the Conventional commits specification, which is also enforced by a Git hook.
Developer documentation
- Official SqualoMail API documentation (in Slovenian and Italian only)
- Endpoint list