$contactData = array( 'first_name' => 'John', 'last_name' => 'Doe', 'email' => 'johndoe@email.com', ); $contact = CRM_Contact_BAO_Contact::createProfileContact($contactData);
$formData = array('first_name' => 'Jane', 'last_name' => 'Doe'); $contactData = CRM_Contact_BAO_Contact::createProfileContact($formData);This code creates a new contact using the form data submitted by the user in their website profile. The createProfileContact method automatically maps the form fields to the corresponding contact properties. The CRM_Contact_BAO_Contact library is part of the CiviCRM package, which is an open-source CRM software designed for non-profit organizations and political campaigns.