// Before a user is saved to the database Hook::add('before_user_save', function($user) { // Modify user data $user['username'] = strtolower($user['username']); $user['password'] = password_hash($user['password'], PASSWORD_DEFAULT); }); // After a user is saved to the database Hook::add('after_user_save', function($user) { // Send email notification mail('admin@example.com', 'New user registered', "Username: {$user['username']}"); });In the above example, two hooks are defined: `before_user_save` and `after_user_save`. The `before_user_save` hook modifies the user data by converting the username to lowercase and hashing the password. The `after_user_save` hook sends an email to the site administrator whenever a new user is registered. Overall, PHP Hook is a powerful tool for developers who want to extend the functionality of their PHP applications. It allows custom code to be added at specific points in the application's execution, making it easier to customize and tailor the application to meet specific needs.