CLAUDE.md — myadmin-plugins/icontact-mailinglist
MyAdmin iContact Mailing List Plugin
6/19/2026 · 14 viewsCLAUDE.md
MyAdmin iContact Mailing List Plugin
Symfony EventDispatcher plugin for MyAdmin that integrates iContact REST API to manage mailing list subscriptions on account activation.
Stack
- PHP >= 5.0 · Namespace:
Detain\MyAdminIcontact\→src/ - Tests:
Detain\MyAdminIcontact\Tests\→tests/ - Events:
GenericEventfrom Symfony EventDispatcher
Commands
composer install
vendor/bin/phpunit tests/ -v
vendor/bin/phpunit --coverage-clover coverage.xml --whitelist src/
Architecture
Entry: src/Plugin.php · class Detain\MyAdminIcontact\Plugin
CI/CD & IDE: .github/ contains workflows for automated testing and deployment pipelines · .idea/ contains IDE project configuration including inspectionProfiles, deployment.xml, and encodings.xml
Hook registration: Plugin::getHooks() returns event → [Plugin::class, 'method'] map:
system.settings→getSettings()— registers 7 settings via$settings->add_*_setting()account.activated→doAccountActivated()— callsdoSetup($accountId)mailinglist.subscribe→doMailinglistSubscribe()— callsdoEmailSetup($email)
Example hook registration in src/Plugin.php:
public static function getHooks(): array
{
return [
'system.settings' => [__CLASS__, 'getSettings'],
'account.activated' => [__CLASS__, 'doAccountActivated'],
'mailinglist.subscribe' => [__CLASS__, 'doMailinglistSubscribe'],
];
}
API flow (doEmailSetup()): build contact array → json_encode → getcurlpage() with iContact headers → parse contactId → subscribe to each list in ICONTACT_LISTS
Example iContact subscription call in src/Plugin.php:
$url = 'https://app.icontact.com/icp/a/' . ICONTACT_CLIENTID
. '/c/' . ICONTACT_CLIENTFOLDERID . '/contacts/';
$response = getcurlpage($url, $json, $options);
myadmin_log('accounts', 'info', 'Response: ' . $response, __LINE__, __FILE__);
$response = @json_decode($response);
if (isset($response->contacts[0]->contactId)) {
// subscribe to each list in ICONTACT_LISTS
}
Constants used: ICONTACT_ENABLE · ICONTACT_APIID · ICONTACT_APIUSERNAME · ICONTACT_APIPASSWORD · ICONTACT_CLIENTID · ICONTACT_CLIENTFOLDERID · ICONTACT_LISTS
iContact endpoints:
POST https://app.icontact.com/icp/a/{clientId}/c/{folderId}/contacts/POST https://app.icontact.com/icp/a/{clientId}/c/{folderId}/subscriptions/
Conventions
- All hook handlers:
public static function, acceptGenericEvent $event, checkICONTACT_ENABLE == 1before acting - Logging:
myadmin_log('accounts', 'info', $message, __LINE__, __FILE__) - Settings: use
add_dropdown_settingfor enable/disable,add_password_settingfor secrets,add_text_settingfor IDs - Static properties:
$name,$description,$help,$type = 'plugin'— allpublic static string - Tests use
ReflectionClassto verify method signatures, static visibility, and parameter types phpunit.xml.distat repo root configures test bootstrap
Adding a New Event Hook
- Add entry to
getHooks()return array using dot-notation event name - Add
public static function doEventName(GenericEvent $event)method - Guard with
defined('ICONTACT_ENABLE') && ICONTACT_ENABLE == 1 - Add corresponding test in
tests/PluginTest.phpwith signature assertions
Quality
.scrutinizer.yml: tabs for indentation, camelCase params/properties,argument_type_checks,duplicationenabled.codeclimate.yml:phpmdengine, cyclomatic complexity threshold 100,tests/excluded from ratings.bettercodehub.yml: php language target
Before Committing
IMPORTANT: Before every git commit, you MUST ensure Caliber syncs agent configs with the latest code changes.
First, check if the pre-commit hook is already installed:
grep -q "caliber" .git/hooks/pre-commit 2>/dev/null && echo "hook-active" || echo "no-hook"
- If hook-active: the hook handles sync automatically — just commit normally. Tell the user: "Caliber will sync your agent configs automatically via the pre-commit hook."
- If no-hook: run Caliber manually before committing:
- Tell the user: "Caliber: Syncing agent configs with your latest changes..."
- Run:
caliber refresh && git add CLAUDE.md .claude/ .cursor/ .cursorrules .github/copilot-instructions.md .github/instructions/ AGENTS.md CALIBER_LEARNINGS.md 2>/dev/null - After it completes, briefly tell the user what Caliber updated. Then proceed with the commit.
If caliber is not found, tell the user: "This project uses Caliber for agent config sync. Run /setup-caliber to get set up."
Session Learnings
Read CALIBER_LEARNINGS.md for patterns and anti-patterns learned from previous sessions.
These are auto-extracted from real tool usage — treat them as project-specific rules.
Source: myadmin-plugins/icontact-mailinglist · 4★ Repo: MyAdmin iContact Mailing List Plugin