PHPackages                             juststeveking/companies-house-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. juststeveking/companies-house-laravel

ActiveLibrary[API Development](/categories/api)

juststeveking/companies-house-laravel
=====================================

A Laravel wrapper to get companies house information and validate company numbers

2.0.4(4y ago)224.1k11[3 PRs](https://github.com/JustSteveKing/companies-house-laravel/pulls)MITPHPPHP ^8.0

Since Sep 16Pushed 2y ago4 watchersCompare

[ Source](https://github.com/JustSteveKing/companies-house-laravel)[ Packagist](https://packagist.org/packages/juststeveking/companies-house-laravel)[ Docs](https://github.com/juststeveking/companies-house-laravel)[ GitHub Sponsors](https://github.com/JustSteveKing)[ RSS](/packages/juststeveking-companies-house-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (8)Versions (10)Used By (0)

Laravel Companies House
=======================

[](#laravel-companies-house)

[![](./companies-house-laravel.png)](./companies-house-laravel.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3854034d15d9e7b8afc8ccfccb7181afab8fa3a94042724366896e90ddf6bde8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a75737473746576656b696e672f636f6d70616e6965732d686f7573652d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juststeveking/companies-house-laravel)[![Tests](https://github.com/juststeveking/companies-house-laravel/workflows/Tests/badge.svg?branch=master)](https://github.com/juststeveking/companies-house-laravel/workflows/Tests/badge.svg?branch=master)[![Total Downloads](https://camo.githubusercontent.com/14cc20641560c27042d652ed06aafe482dec9b6836040f4b519596d8bd72083a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a75737473746576656b696e672f636f6d70616e6965732d686f7573652d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juststeveking/companies-house-laravel)

A Laravel wrapper to get companies house information and validate company numbers.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require juststeveking/companies-house-laravel
```

You can publish the config file with:

```
php artisan vendor:publish --provider="JustSteveKing\CompaniesHouse\CompaniesHouseServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [
    'api' => [
        'key' => env('COMPANIES_HOUSE_KEY', ''),
        'url' => env('COMPANIES_HOUSE_URL', 'https://api.company-information.service.gov.uk'),
        'timeout' => env('COMPANIES_HOUSE_TIMEOUT', 10),
        'retry' => [
            'times' => env('COMPANIES_HOUSE_RETRY_TIMES', null),
            'milliseconds' => env('COMPANIES_HOUSE_RETRY_MILLISECONDS', null),
        ],
    ]
];
```

Usage
-----

[](#usage)

This library is aimed to be easy to use, and slots into Laravel with no issues.

The package will install a Service Provider for you, meaning that all you need to do is resolve the `Client` from the container, and start using it.

### Get A Company Profile

[](#get-a-company-profile)

To get a company profile, you can quite simply:

```
use JustSteveKing\CompaniesHouse\Client;

class CompanyController extends Controler
{
    public function __construct(
        protected Client $service,
    ) {}

    public function __invoke(Request $request)
    {
        $company = $this->service->company(
            companyNumber: $request->get('company_number')
        );
    }
}
```

Get A Companies Officers
------------------------

[](#get-a-companies-officers)

You can get a `Collection` of Company Officers using the companies number:

```
use JustSteveKing\CompaniesHouse\Client;

class CompanyOfficersController extends Controler
{
    public function __construct(
        protected Client $service,
    ) {}

    public function __invoke(Request $request)
    {
        $company = $this->service->officers(
            companyNumber: $request->get('company_number')
        );
    }
}
```

### Get a specific Officer from a Company

[](#get-a-specific-officer-from-a-company)

You can get an `Officer` from a company using the company number and their appointment ID:

```
use JustSteveKing\CompaniesHouse\Client;

class CompanyOfficerController extends Controler
{
    public function __construct(
        protected Client $service,
    ) {}

    public function __invoke(Request $request)
    {
        $company = $this->service->officer(
            companyNumber: $request->get('company_number'),
            appointmentId: $request->get('appointment_id'),
        );
    }
}
```

### Searching

[](#searching)

There are a few options when it comes to searching, you can search for:

- companies
- officers
- disqualified officers
- search all

#### Searching for Companies

[](#searching-for-companies)

This will return a `SearchCollection`

```
use JustSteveKing\CompaniesHouse\Client;

class CompanySearchController extends Controler
{
    public function __construct(
        protected Client $service,
    ) {}

    public function __invoke(Request $request)
    {
        $results = $this->service->searchCompany(
            query: $request->get('query'),
            perPage: 25, //optional
            startIndex: 0, //optional
        );
    }
}
```

#### Searching for Officers

[](#searching-for-officers)

This will return a `SearchCollection`

```
use JustSteveKing\CompaniesHouse\Client;

class OfficersSearchController extends Controler
{
    public function __construct(
        protected Client $service,
    ) {}

    public function __invoke(Request $request)
    {
        $results = $this->service->searchOfficers(
            query: $request->get('query'),
            perPage: 25, //optional
            startIndex: 0, //optional
        );
    }
}
```

#### Searching everything

[](#searching-everything)

This will return a `SearchCollection`

```
use JustSteveKing\CompaniesHouse\Client;

class SearchController extends Controler
{
    public function __construct(
        protected Client $service,
    ) {}

    public function __invoke(Request $request)
    {
        $results = $this->service->search(
            query: $request->get('query'),
            perPage: 25, //optional
            startIndex: 0, //optional
        );
    }
}
```

Validation
----------

[](#validation)

Using the validation inline:

```
$this->validate($request, [
    'company_number' => [
        'required',
        'string',
        Rule::companyNumber()
    ]
]);
```

Testing
-------

[](#testing)

To understand how to use this part please follow the Laravel documentation for [Testing the Http Client](https://laravel.com/docs/8.x/http-client#testing)

Run the unit tests:

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Steve McDougall](https://github.com/JustSteveKing)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 98.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~45 days

Recently: every ~32 days

Total

9

Last Release

1701d ago

Major Versions

1.3.0 → 2.0.02021-05-07

PHP version history (3 changes)v1.0.0PHP ^7.4

1.3.0PHP ^7.4|^8.0

2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a87fe82b349821ebd49cf57d65c4cd3e33ae0833222a8438d90fe8921ca899ea?d=identicon)[JustSteveKing](/maintainers/JustSteveKing)

---

Top Contributors

[![JustSteveKing](https://avatars.githubusercontent.com/u/6368379?v=4)](https://github.com/JustSteveKing "JustSteveKing (78 commits)")[![jeffcaulfield-morphsites](https://avatars.githubusercontent.com/u/13965313?v=4)](https://github.com/jeffcaulfield-morphsites "jeffcaulfield-morphsites (1 commits)")

---

Tags

apicompanies-house-apilaravelvalidationapivalidationintegrationJustSteveKingcompanies housecompanies-house-laravel

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/juststeveking-companies-house-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/juststeveking-companies-house-laravel/health.svg)](https://phpackages.com/packages/juststeveking-companies-house-laravel)
```

###  Alternatives

[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)[lasserafn/laravel-economic

Economic REST wrapper for Laravel

1118.5k](/packages/lasserafn-laravel-economic)[offline-agency/laravel-fatture-in-cloud

An integration plugin with Fatture in Cloud Api written in Laravel PHP

101.1k](/packages/offline-agency-laravel-fatture-in-cloud)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
