1. Go to this page and download the library: Download rossjcooper/laravel-hubspot library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rossjcooper / laravel-hubspot example snippets
// Echo all contacts first and last names
$response = HubSpot::crm()->contacts()->basicApi()->getPage();
foreach ($response->getResults() as $contact) {
echo sprintf(
"Contact name is %s %s." . PHP_EOL,
$contact->getProperties()['firstname'],
$contact->getProperties()['lastname']
);
}
Route::get('/', function (HubSpot\Discovery\Discovery $hubspot) {
$response = $hubspot->crm()->contacts()->basicApi()->getPage();
foreach ($response->getResults() as $contact) {
echo sprintf(
"Contact name is %s %s." . PHP_EOL,
$contact->getProperties()['firstname'],
$contact->getProperties()['lastname']
);
}
});
// Create a new contact
$contactInput = new \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate();
$contactInput->setProperties([
'email' => '[email protected]'
]);
$contact = $hubspot->crm()->contacts()->basicApi()->create($contactInput);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.