2017 © Pedro Peláez
 

library companies-house

Client to interact with Companies House API

image

dljfield/companies-house

Client to interact with Companies House API

  • Monday, April 24, 2017
  • by dljfield
  • Repository
  • 0 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Companies House API Client

A simple API client for the Companies House API., (*1)

Installation

This client can be installed with Composer:, (*2)

composer require dljfield/companies-house

Endpoints

This client currently has at least partial support for the following endpoints of the Companies House API:, (*3)

Usage

To use the client, you must create an instance of DLJField\CompaniesHouse\Client, passing your Companies House API key into the constructor., (*4)

Responses

All endpoints return a named class as a response., (*5)

Except for the DocumentContents type, these classes are simple data objects that contain the response contents of the API call. As such, you can iterate over them and access them the way you would any other simple data object. e.g., (*6)

$companyProfile = $companiesHouseClient->getCompanyProfile($companyNumber);

foreach ($companyProfile as $field) {
    echo $field;
}

echo $companyProfile->next_accounts->due_on;

DocumentContents instead has two fields: - $content - $contentLength, (*7)

The content should be the file available to stream directly to the browser, e.g., (*8)

$pdfFile = $companiesHouseClient->getDocumentContents($documentId, DocumentContents::CONTENT_TYPE_PDF);

header("Content-type: application/octet-stream");
header("Content-disposition: attachment;filename=filing-history-document.pdf");

echo $pdfFile->content;
exit;

Exceptions

If an API call fails, an exception will be thrown. As well as a normal exception message, these exceptions hold a statusCode parameter, a reason parameter and a contents parameter. These are the status code of the API response, the reason phrase associated with that status code, and any response body returned from the Companies House API (such as their own errors)., (*9)

The Versions

24/04 2017

dev-master

9999999-dev

Client to interact with Companies House API

  Sources   Download

MIT

The Requires

 

by David Field

24/04 2017

v0.1.4

0.1.4.0

Client to interact with Companies House API

  Sources   Download

MIT

The Requires

 

by David Field

10/04 2017

v0.1.3

0.1.3.0

Client to interact with Companies House API

  Sources   Download

MIT

The Requires

 

by David Field

20/03 2017

v0.1.2

0.1.2.0

Client to interact with Companies House API

  Sources   Download

MIT

The Requires

 

by David Field

02/03 2017

v0.1.1

0.1.1.0

Client to interact with Companies House API

  Sources   Download

MIT

The Requires

 

by David Field

02/03 2017

v0.1.0

0.1.0.0

Client to interact with Companies House API

  Sources   Download

MIT

The Requires

 

by David Field