PHP code example of philwc / companies-house

1. Go to this page and download the library: Download philwc/companies-house 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/ */

    

philwc / companies-house example snippets




$apiKey = 'API KEY HERE';

/** @var \philwc\Call\Search\Name $nameSearch */
$nameSearch = \philwc\CompaniesHouseFactory::get('Search', 'Name', $apiKey);
/** @var \philwc\Call\Search\Number $numberSearch */
$numberSearch = \philwc\CompaniesHouseFactory::get('Search', 'Number', $apiKey);

$results = $nameSearch->search('cast uk');
/** @var \philwc\Entity\CompanySearch $result */
foreach ($results as $result) {
    /** @var \philwc\Entity\CompanyProfile $company */
    $company = $numberSearch->search($result->getCompanyNumber());

    // Do something with company...
}