daveismyname / laravel-companies-house
A Laravel Companies House package
Fund package maintenance!
dcblogdev
Requires
- guzzlehttp/guzzle: ^6|^7
This package is auto-updated.
Last update: 2023-10-23 12:02:27 UTC
README
There is a Discord community. https://discord.gg/VYau8hgwrm For quick help, ask questions in the appropriate channel.
A Laravel package for reading Companies House.
Documentation and install instructions
Companies House API documentation can be found at: https://developer.company-information.service.gov.uk/api/docs/
Application Register
To use Companies House an application needs creating at https://developer.companieshouse.gov.uk/developer/applications
Install
Take a note of the API key and add it to your .env file
COMPANIES_HOUSE_KEY=
Via Composer
composer require dcblogdev/laravel-companies-house
You can publish the config file with:
php artisan vendor:publish --provider="Dcblogdev\CompaniesHouse\CompaniesHouseServiceProvider" --tag="config"
When published, the config/companieshouse.php config file contains:
<?php return [ /* * the key is set from the Companies House to identify the application * https://developer.companieshouse.gov.uk/developer/applications */ 'key' => env('COMPANIES_HOUSE_KEY'), ];
Usage
In a controller import the class:
use Dcblogdev\CompaniesHouse\Facades\CompaniesHouse;
In a view or closure call the facade:
CompaniesHouse::get('path');
You call CompaniesHouse followed by get:: this will run a GET request followed by the endpoint you want to call, for instance, to call company profile (https://developer.companieshouse.gov.uk/api/docs/company/company_number/company_number.html)
CompaniesHouse::get('company/123456');
To make things a little easier there is also trait classes provided:
Each Trait class provides convenient methods that call the endpoints, processes the data, and returns JSON of the results.
Search
Search across all indexed information.
CompaniesHouse::search($term)
Searches companies
CompaniesHouse::searchCompany($term)
Search Officer
CompaniesHouse::searchOfficer($term)
Search Officer Disqualified
CompaniesHouse::searchOfficerDisqualified($term)
Companies
Get Company
CompaniesHouse::getCompany($companyNumber)
Get Company Address
CompaniesHouse::getCompanyAddress($companyNumber)
Get Company Officer
CompaniesHouse::getCompanyOfficer($companyNumber)
Get Company Filing
CompaniesHouse::getCompanyFiling($companyNumber)
Get Company Filing Item
CompaniesHouse::getCompanyFilingItem($companyNumber)
Get Company Insolvency
CompaniesHouse::getCompanyInsolvency($companyNumber)
Get Company Charge
CompaniesHouse::getCompanyCharge($companyNumber)
Get Company Charge Item
CompaniesHouse::getCompanyChargeItem($companyNumber)
Get Company Establishment
CompaniesHouse::getCompanyEstablishment($companyNumber)
Get Company Register
CompaniesHouse::getCompanyRegister($companyNumber)
Get Company Exemption
CompaniesHouse::getCompanyExemption(($companyNumber)
Officer
Get Officer Appointment
CompaniesHouse::getOfficerAppointment($officerId)
Get Officer Disqualification
CompaniesHouse::getOfficerDisqualification($officerId)
Get Officer Disqualification Corp
CompaniesHouse::getOfficerDisqualificationCorp($officerId)
Change log
Please see the changelog for more information on what has changed recently.
Contributing
Contributions are welcome and will be fully credited.
Contributions are accepted via Pull Requests on Github.
Pull Requests
-
Document any change in behaviour - Make sure the
readme.md
and any other relevant documentation are kept up-to-date. -
Consider our release cycle - We try to follow SemVer v2.0.0. Randomly breaking public APIs is not an option.
-
One pull request per feature - If you want to do more than one thing, send multiple pull requests.
Security
If you discover any security related issues, please email dave@daveismyname.com email instead of using the issue tracker.
License
license. Please see the license file for more information.