HubSpot-php CRM-objects sample app
May 4, 2021 ยท View on GitHub
Requirements
- php >=7.2.5
- Configured .env file
Running
- Install dependencies
composer i
- Initialize
If .env config file was not configured manually there is a way to initialize the CLI and create .env file via:
./bin/cli.php app:init
It will ask for your Hubspot Api Key and will save it to the new .env config file.
- Commands
Show all commands
./bin/cli.php
Get All objects
./bin/cli.php objects:get [objectType] --all
Get an object by Id
./bin/cli.php objects:get [objectType] --id=[objectId]
Search an object by query
./bin/cli.php objects:get [objectType] --query=test
Create new object
./bin/cli.php objects:create [objectType] [properties]
For example:
./bin/cli.php objects:create companies name=newCompany city=Cambridge state=Massachusetts
Please also notice that some objects require mandatory properties.
Update an object by Id
./bin/cli.php objects:update [objectType] [objectId] [properties]
For example:
./bin/cli.php objects:update contacts 123456 firstname=Ryan
Delete an object by Id
./bin/cli.php objects:delete [objectType] [objectId]