PHPackages                             patrixshah-uk-vat-checker/hmrc-vat-check - 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. patrixshah-uk-vat-checker/hmrc-vat-check

ActiveLibrary[API Development](/categories/api)

patrixshah-uk-vat-checker/hmrc-vat-check
========================================

A Laravel package to check UK VAT numbers by using HMRC Goverment Portal. It's using VAT API version 2.0 with OAuth 2.

1.0.0(1y ago)0151MITPHP ^7.4|^8.0

Since Aug 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/patrixshah/hmrc-vat-check)[ Packagist](https://packagist.org/packages/patrixshah-uk-vat-checker/hmrc-vat-check)[ RSS](/packages/patrixshah-uk-vat-checker-hmrc-vat-check/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

HMRC UK VAT Check Laravel Package
=================================

[](#hmrc-uk-vat-check-laravel-package)

A Laravel package to check UK VAT numbers using the HMRC VAT API. This package provides an easy way to integrate VAT number validation in your Laravel application.

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

[](#installation)

You can install the package via composer. Run the following command:

```
composer require patrixshah-uk-vat-checker/hmrc-vat-check
```

Configuration
-------------

[](#configuration)

After installing the package, you need to publish the configuration file to customize your API credentials and endpoint URLs.

- Step 1: Publish Configuration File Run the following Artisan command to publish the configuration file:

    ```
    php artisan vendor:publish --provider="PatrixshahUKVatChecker\HmrcVatCheck\HmrcVatCheckServiceProvider" --tag=config
    ```

    This command will create a hmrc\_vat.php configuration file in your config directory.
- Step 2: Set Environment Variables Next, you need to set the required environment variables in your .env file. Add the following lines to your .env file:

    ```
    HMRC_CLIENT_ID=your-client-id
    HMRC_CLIENT_SECRET=your-client-secret
    HMRC_OAUTH2_URL=https://test-api.service.hmrc.gov.uk/oauth/token
    HMRC_GRANT_TYPE=client_credentials
    HMRC_SCOPE=read:vat
    HMRC_CHECK_VAT_NUMBER=https://test-api.service.hmrc.gov.uk/organisations/vat/check-vat-number/lookup
    ```

    Replace the placeholders with your actual HMRC API credentials and URLs.
- Step 3: Clear Configuration Cache To ensure Laravel recognizes your new configuration, clear the configuration cache:

    ```
    php artisan config:clear
    ```

Usage
-----

[](#usage)

Once you have installed and configured the package, you can use it to check VAT numbers through an API endpoint.

Example API Usage The package provides an API endpoint that you can use to check a VAT number.

- Step 1: Define the Route (Optional) If you want to define a custom route in your Laravel application, add the following to your routes/api.php file:

    ```
    use Illuminate\Support\Facades\Route;
    use YourVendorName\HmrcVatCheck\Controllers\VatCheckController;
    Route::post('/api/vat/check', [VatCheckController::class, 'checkVatNumber']);
    ```

    If the route is already defined in the package, you can skip this step.

- Step 2: Make an API Request You can now make a POST request to the /api/vat/check endpoint with the VAT number:

    ```
    curl -X POST http://your-app-url/api/vat/check \
     -H "Content-Type: application/json" \
     -d '{"vat_number": "GB123456789"}'
    ```
- Step 3: Handle the Response If the VAT number is valid, you will receive a JSON response like this:

    ```
    {
        "success": true,
        "data": {
            "target": {
                "name": "MS&AD Insurance",
                "vatNumber": "293129633",
                "address": {
                    "line1": "82 Clemie Close",
                    "postcode": "RM37 4KI",
                    "countryCode": "GB"
                }
            },
            "processingDate": "2024-08-23T13:14:06+01:00"
        }
    }
    ```

    If there is an error or the VAT number is invalid, you will receive a response like this:

    ```
    {
        "success": false,
        "message": "Error checking VAT number: [Error Details]"
    }
    ```

Customization
-------------

[](#customization)

Configuring HMRC API Credentials You can change the API credentials and other settings by modifying the config/hmrc\_vat.php file

```
return [
    'client_id' => env('HMRC_CLIENT_ID', 'your-client-id'),
    'client_secret' => env('HMRC_CLIENT_SECRET', 'your-client-secret'),
    'oauth2_url' => env('HMRC_OAUTH2_URL', 'https://test-api.service.hmrc.gov.uk/oauth/token'),
    'grant_type' => env('HMRC_GRANT_TYPE', 'client_credentials'),
    'scope' => env('HMRC_SCOPE', 'read:vat'),
    'check_vat_number_url' => env('HMRC_CHECK_VAT_NUMBER', 'https://test-api.service.hmrc.gov.uk/organisations/vat/check-vat-number/lookup'),
];
```

Make sure to update these values according to your needs and the environment you are working in.

Author
------

[](#author)

- **Name:** Pratik Shah
- **LinkedIn:** [Pratik Shah](https://www.linkedin.com/in/patrixshah/)

License
-------

[](#license)

This package is open-source software licensed under the MIT License.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

680d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1110065?v=4)[Pratik Shah](/maintainers/patrixshah)[@patrixshah](https://github.com/patrixshah)

---

Top Contributors

[![patrixshah](https://avatars.githubusercontent.com/u/1110065?v=4)](https://github.com/patrixshah "patrixshah (1 commits)")

---

Tags

hmrclaravel-packagephp8uk-vatapilaravelpackagevathmrcuk-vat-checker

### Embed Badge

![Health badge](/badges/patrixshah-uk-vat-checker-hmrc-vat-check/health.svg)

```
[![Health](https://phpackages.com/badges/patrixshah-uk-vat-checker-hmrc-vat-check/health.svg)](https://phpackages.com/packages/patrixshah-uk-vat-checker-hmrc-vat-check)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

74331.3k1](/packages/mozex-anthropic-laravel)[smodav/mpesa

M-Pesa API implementation

16467.9k1](/packages/smodav-mpesa)[bmatovu/laravel-mtn-momo

Laravel MTN MOMO integration.

14312.8k](/packages/bmatovu-laravel-mtn-momo)

PHPackages © 2026

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