Download the PHP package vpndetector/laravel-vpn-detector without Composer

On this page you can find all versions of the php package vpndetector/laravel-vpn-detector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-vpn-detector

🛡️ Laravel VPN Detector

Block VPN, proxy, and Tor traffic in your Laravel application — powered by the IP2Proxy PX2 database.

PHP Laravel


What it does

Laravel VPN Detector looks up every incoming request's IP address against a local copy of the IP2Proxy database and can:

All lookups are done in-process against your own database — no external API calls at runtime, no latency overhead.


How it works


Requirements

Dependency Version
PHP ^8.3
Laravel ^12.0
MySQL / MariaDB Any version supporting INET_ATON / INET6_ATON
IP2Proxy account Free tier works (PX2 database)

Installation

1. Install via Composer

2. Publish config and migrations

3. Set your IP2Proxy token

Add your download token to .env (get it at ip2location.com):

4. Import the database

This downloads the PX2 CSV files from IP2Proxy (~300 MB each), extracts them, and bulk-imports them into the two database tables. Expect it to take 2–5 minutes on first run.


Architecture

The package is built around three layers:

IpLookupResult DTO is returned by checkProxyType() instead of raw stdClass, giving you typed, expressive access to the result:

The VpnDetector Facade provides a clean static interface:


Configuration

After publishing, config/vpn-detector.php exposes:

Full list of .env keys: see .env.example.


Usage

Middleware — block VPN/proxy users

Register BlockVpnMiddleware on any route or group:

Blocked requests receive a 403 Access via VPN or proxy is not permitted. response.


Action — force-logout Tor users

Use CheckVpnBlocked in your own middleware or controller when you want finer control (e.g. only log out authenticated Tor users):

The IP is cached in the session so the database is only queried once per unique IP per session.


Service — direct injection

Inject VpnDetectionService (or its interface) anywhere:


Scheduler — keep the database fresh

Add SchedulesVpnDetector to your console kernel to automatically refresh the IP2Proxy data:


Database tables

The package creates two tables populated from the IP2Proxy PX2 dataset:

Column Type Description
ip_from decimal(39,0) Start of IP range (integer representation)
ip_to decimal(39,0) End of IP range
proxy_type varchar(3) VPN, TOR, PUB, WEB, -
country_code char(2) ISO 3166-1 alpha-2
country_name varchar(64) Full country name

Both ip_from and ip_to form a composite primary key, allowing efficient range lookups via INET_ATON / INET6_ATON.

Note: IP2Proxy recommends using the IPv6 table for both IPv4 and IPv6 queries, but coverage is incomplete in practice. This package queries both tables, routing by address family.


Benchmark

The package ships with a self-contained benchmark command. It generates 6 000 000 synthetic rows (3M IPv4 + 3M IPv6) into a temporary SQLite file, then measures lookup latency — no real IP2Proxy database or API token required.

Example output (AMD Ryzen 7, SQLite — MySQL with proper indexes will be significantly faster):

These numbers use SQLite as the backend. Production MySQL/MariaDB with a real IP2Proxy dataset and proper indexes will have lower raw lookup latency; the cache speedup ratio (~20 000x) holds regardless of the database engine.



All versions of laravel-vpn-detector with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^12.0
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vpndetector/laravel-vpn-detector contains the following files

Loading the files please wait ...