user.logout:before $user, $session /site/config/config.php return [ 'hooks' => [ 'user.logout:before' => function ($user, $session) { // your code goes here } ] ]