$validator ->requirePresence('name') ->notEmpty('name', 'Please enter a name.') ->requirePresence('email') ->notEmpty('email', 'Please enter an email.');This will check if both the "name" and "email" fields are present in the submitted data. If either of them is missing, it will display the error message "Please enter a name" or "Please enter an email". Package library name: cakephp/validation.