SevenShores\Hubspot\Resources\Companies::getByDomain PHP Method

getByDomain() public method

Returns an array of companies that have a matching domain
See also: http://developers.hubspot.com/docs/methods/companies/get_companies_by_domain
public getByDomain ( string $domain ) : Response
$domain string The domain of the company eq. 'example.com'.
return SevenShores\Hubspot\Http\Response
    function getByDomain($domain)
    {
        $endpoint = "https://api.hubapi.com/companies/v2/companies/domain/{$domain}";
        return $this->client->request('get', $endpoint);
    }

Usage Example

Example #1
0
 /** @test */
 public function getByDomain()
 {
     $domain = 'example.com';
     $response = $this->companies->getByDomain($domain);
     $this->assertEquals(200, $response->getStatusCode());
     $this->assertEquals($domain, $response[0]['properties']['domain']['value']);
 }