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 1mo 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 37% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

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

627d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ffa80b2597b18fb738b3354d2ae5283e7cbcccb17813afc308f8e5e3ac02cf52?d=identicon)[patrixshah](/maintainers/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

[joisarjignesh/bigbluebutton

BigBlueButton Server API Library for Laravel

162145.5k1](/packages/joisarjignesh-bigbluebutton)[bmatovu/laravel-mtn-momo

Laravel MTN MOMO integration.

14310.9k](/packages/bmatovu-laravel-mtn-momo)[gregoriohc/laravel-trello

A Laravel wrapper and facade package for the Trello API

3366.8k2](/packages/gregoriohc-laravel-trello)[vinelab/api-manager

Laravel API Manager Package - beatify and unify your responses with the least effort possible.

392.1k](/packages/vinelab-api-manager)

PHPackages © 2026

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