Downloads
Stars
Version
This is a PHP wrapper for the Companies House API. Auto discovery for Laravel has been added so you should be able to use this out of the box with Laravel.
When using this it's best advised to use an environment file to store the API key and base url. This ensures you don't have any API keys sat in the source code of the application and also not committed into any version control.
This currently does not include the Document API which is also available.
Before you can start using the Companies House API you will need to register your application in your companies house developer account: https://developer.companieshouse.gov.uk/developer/applications
The API Key provided from registering your application with Companies House will be required.
Via Composer
$ composer require ashleighsims/companies-house-api-wrapper
If you're using this package in Laravel auto discovery has been enabled so you should be able to hit the ground running (when using Laravel 5.5 and beyond).
if you aren't using Laravel 5.5 and above you will need to manually register some bits...
Register the provider in the app.php file:
AshleighSims\CompaniesHouseApiWrapper\Laravel\CompaniesHouseApiWrapperServiceProvider::class
Optionally register the Facade:
'GetAddress' => AshleighSims\CompaniesHouseApiWrapper\Laravel\CompaniesHouseApiWrapperServiceProvider::class
Please ensure you've added the below environment variables to your .env
file before starting.
Add the following environment variables to your .env file.
COMPANIES_HOUSE_API_BASE_URL="https://api.companieshouse.gov.uk/"
COMPANIES_HOUSE_API_KEY="your-api-key-from-companies-house"
This covers all the endpoints which are currently available on the Companies House Website as of 18th February 2020.
Each endpoint is listed below with code examples. For Laravel users you can type-hint the CompaniesHouseApiWrapper through constructors or through the facade.
use AshleighSims\CompaniesHouseApiWrapper\CompaniesHouseApiWrapper;
...
private $companiesHouse;
public function __construct(CompaniesHouseApiWrapper $companiesHouse) {
$this->companiesHouse = $companiesHouse;
}
public function getAddress() {
$response = $this->companiesHouse->registeredOfficeAddress()->get('00014259');
}
...
use AshleighSims\CompaniesHouseApiWrapper\Laravel\Facades\CompaniesHouseApiWrapper;
...
public function getAddress() {
$response = CompaniesHouseApiWrapper::registeredOfficeAddress()->get('00014259');
}
...
Arguments:
Optional Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->search()->searchAll('Your Query Here'); // Returns a json_decoded associative array
Arguments:
Optional Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->search()->searchCompany("Deathstar Co"); // Returns a json_decoded associative array
Arguments:
Optional Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->search()->searchOfficer("Luke Skywalker"); // Returns a json_decoded associative array
Arguments:
Optional Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->search()->searchDisqualifiedOfficer("Finn FN-2187"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->companyProfile()->get("00014259"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->registeredOfficeAddress()->get("00014259"); // Returns a json_decoded associative array
Arguments:
Optional Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->companyOfficers()->list("00014259"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->filingHistory()->get("00014259", "MzI1Mjg3MzI5MGFkaXF6a2N4"); // Returns a json_decoded associative array
Arguments:
Optional Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->filingHistory()->list("00014259"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->insolvency()->get("00014259", "MzI1Mjg3MzI5MGFkaXF6a2N4"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->charges()->get("00014259", "D0ReqeVClRjR7C-o5ySBBRZnxvU"); // Returns a json_decoded associative array
Arguments:
Optional Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->charges()->list("00014259"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->officerAppointmentList()->list("hLPe3meaIVQ0pqqn5AmvvS_V8pA"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->officerDisqualifications()->getNatural("Ff-EjRku_DxTJnG6uBq2ie8jmLc"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->officerDisqualifications()->getCorporate("Ff-EjRku_DxTJnG6uBq2ie8jmLc"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->ukEstablishmentCompanies()->list("00014259"); // Returns a json_decoded associative array
Arguments:
Optional Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->personsWithSignificantControl()->list("00014259"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->personsWithSignificantControl()->getIndividual("06637776", "tRjwr1Q2U9uhtZ86JoeexAKF1Co"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->personsWithSignificantControl()->getCorporateEntities("00014259", "kISgW15ODWvznzBMq6Tv6ObCsLg"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->personsWithSignificantControl()->getLegalPersons("00014259", "a-legal-persons-officer-id"); // Returns a json_decoded associative array
Arguments:
Optional Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->personsWithSignificantControl()->listStatements("00014259", "a-legal-persons-officer-id"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->personsWithSignificantControl()->getStatement("00014259", "statement-id"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->personsWithSignificantControl()->getSuperSecurePerson("00014259", "super-secure-id"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->companyRegisters()->get("00014259"); // Returns a json_decoded associative array
Arguments:
$companiesHouse = new CompaniesHouseApiWrapper('your-api-key', 'https://api.companieshouse.gov.uk/');
$response = $companiesHouse->companyExemptions()->get("00014259"); // Returns a json_decoded associative array
Please see the changelog for more information on what has changed recently.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
license. Please see the license file for more information.