Hooks

Klub triggers hooks during checkout, subscription changes, and license checks. Use this page to sync roles, send notifications, or log activity.

Checkout and subscriptions

  • klub.payment:before ($user, $session, $data)
  • klub.payment:after ($user, $session, $data)
  • klub.subscribe:before ($user, $session, $data)
  • klub.subscribe:after ($user, $session, $data)
  • klub.change:before ($user, $subscriptionId, $priceId, $data)
  • klub.change:after ($user, $subscription, $data)
  • klub.renew:before ($user, $subscriptionId, $data)
  • klub.renew:after ($user, $subscription, $data)
  • klub.cancel:before ($user, $subscriptionId, $data)
  • klub.cancel:after ($user, $subscription, $data)

Members and auth

  • klub.member.created ($user)
  • klub.signup ($user)

Progress

  • klub.progress.add ($user, $id)
  • klub.progress.remove ($user, $id)

License checks

  • klub.license.checked ($members, $maxMembers)
  • klub.license.failed ($members, $maxMembers, $msg)

Example

<?php

return [
  'hooks' => [
    'klub.subscribe:after' => function ($user, $session) {
      if ($session?->price_id === 'pro_monthly') {
        $user->changeRole('pro');
      }
    },
  ],
];
Kirby Klub is not affiliated with the developers of Kirby CMS. We are merely standing on the shoulder of giants.
© 2026 Bruno Meilick All rights reserved.