This is a PHP client library for the Mailkit email marketing platform API. It wraps the Mailkit XML-RPC and JSON API interfaces into a typed, object-oriented PHP library.
Repository: https://github.com/Spoje-NET/mailkit-api Package: meditorial/mailkit-api PHP: >= 8.1 License: BSD-3-Clause
MailkitApi class is the main entry point. It creates manager instances with a shared RPC client.
Each API area has a dedicated manager:
UsersManager- User/subscriber management (getstatus, adduser, edituser, unsubscribe, revalidate, delete)MailingListsManager- Mailing list CRUD operationsMessagesManager- Campaign mail sending (sendmail)WebHooksManager- Webhook payload processing (subscribe/unsubscribe)
Clientdispatches requests to adaptersXmlAdapter- XML-RPC viaxmlrpc_encode_request/xmlrpc_decodeto https://api.mailkit.eu/rpc.fcgiJsonAdapter- JSON API viaNette\Utils\Jsonto https://api.mailkit.eu/json.fcgi- Both adapters require
client_idandclient_md5authentication
All enums use native PHP 8.1 backed enums (not the Consistence library):
Gender: string(M, F)UserStatus: string(enabled, disabled, unknown, temporary, permanent, unsubscribe)InsertStatus: int(0-4)SendMailResultStatus: int(0-4, 6-7)MailingListStatus: string(enabled, disabled)UnsubscribeMethod: string(link_in_mail, manual, spam_report, etc.)
Use ::from($value) to create, ::tryFrom($value) for nullable, ->value to get the scalar value.
- PHP CS Fixer with
ergebnis/php-cs-fixer-config(Php81 ruleset) - Run
make csto auto-fix - Run
make static-code-analysisfor PHPStan
- Framework: Nette Tester (NOT PHPUnit)
- Test files:
tests/IgloonetTests/MailkitApi/*.phpt - Run:
make testsorvendor/bin/tester tests - Mock adapters (
XmlAdapterMock,JsonAdapterMock) load fixture XML/JSON files fromtests/IgloonetTests/MailkitApi/mock-files/api-data/ ClientMockwires mock adapters into the RPC client
- Do NOT use
Consistence\Enum\Enumor::get()— use native PHP enums with::from() - Do NOT use
Strings::startsWith/Strings::endsWith— use nativestr_starts_with/str_ends_with - The
ext-xmlrpcPHP extension is required and must be installed separately on PHP 8.x+ - Mailkit API always uses UTF-8 encoding
- API calls require whitelisted IP addresses configured in the Mailkit account