PHPackages                             punterdigital/tcpshield - 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. punterdigital/tcpshield

ActiveLibrary[API Development](/categories/api)

punterdigital/tcpshield
=======================

A PHP wrapper for the TCPShield API, optimized for Laravel

v1.0.0(1y ago)01MITPHPPHP ^7.4|^8.0CI passing

Since Apr 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/PunterDigital/tcpshield-php-wrapper)[ Packagist](https://packagist.org/packages/punterdigital/tcpshield)[ RSS](/packages/punterdigital-tcpshield/feed)WikiDiscussions main Synced 1mo ago

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

TCPShield API - PHP Wrapper
===========================

[](#tcpshield-api---php-wrapper)

This package provides an easy-to-use PHP wrapper for the TCPShield API, with enhanced support for Laravel applications.

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

[](#installation)

You can install the package via composer:

```
composer require punterdigital/tcpshield
```

Laravel Integration
-------------------

[](#laravel-integration)

### Service Provider

[](#service-provider)

The package includes a service provider that will automatically register the TCPShield client:

```
// config/app.php

'providers' => [
    // ...
    PunterDigital\TCPShield\TCPShieldServiceProvider::class,
];
```

If you're using Laravel 5.5 or higher, the service provider will be automatically registered.

### Configuration

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="PunterDigital\TCPShield\TCPShieldServiceProvider" --tag="config"
```

This will create a `config/tcpshield.php` file. You can set your API key in your `.env` file:

```
TCPSHIELD_API_KEY=your-api-key

```

### Facade

[](#facade)

The package includes a facade for more convenient usage:

```
// config/app.php

'aliases' => [
    // ...
    'TCPShield' => PunterDigital\TCPShield\TCPShieldFacade::class,
];
```

Basic Usage
-----------

[](#basic-usage)

### Direct Client Usage

[](#direct-client-usage)

```
use PunterDigital\TCPShield\TCPShield;

// Instantiate the client
$client = new TCPShield('your-api-key');

// Get all networks
$networks = $client->getNetworks();

// Create a new network
$newNetwork = $client->createNetwork('My Network');

// Get details for a specific network
$network = $client->getNetwork(123);

// Add domain to network
$client->createDomain(123, 'example.com', 456, false);
```

### Using the Facade in Laravel

[](#using-the-facade-in-laravel)

```
use TCPShield;

// Get all networks
$networks = TCPShield::getNetworks();

// Create a new network
$newNetwork = TCPShield::createNetwork('My Network');
```

### Using the Models (Laravel)

[](#using-the-models-laravel)

The package includes Eloquent-like models for working with TCPShield resources:

```
use PunterDigital\TCPShield\Models\Network;
use PunterDigital\TCPShield\Models\Domain;
use PunterDigital\TCPShield\Models\BackendSet;

// Get all networks
$networks = Network::all();

// Find a specific network
$network = Network::find(123);

// Create a new network
$network = Network::create('My Network');

// Update a network
$network->update([
    'name' => 'Updated Network Name',
    'mitigation_message' => 'You have been blocked'
]);

// Get domains for a network
$domains = $network->domains();

// Get backend sets for a network
$backendSets = $network->backendSets();

// Create a new domain
$domain = Domain::create(123, 'example.com', 456, false);

// Create a new backend set
$backendSet = BackendSet::create(
    123,             // Network ID
    'My Backends',   // Name
    [                // Backends
        '127.0.0.1:25565',
        '10.0.0.1:25565'
    ],
    true,            // Proxy Protocol
    false,           // Vulcan AC Enabled
    0                // Load Balancing Mode
);
```

Available Methods
-----------------

[](#available-methods)

This package provides comprehensive coverage of the TCPShield API endpoints, including:

- Networks management
- Domains management
- Backend sets management
- Firewall rules (IP, ASN, Country)
- Bedrock tunnels
- Sentry tunnels
- Analytics
- User management

See the TCPShield API documentation for detailed information on each endpoint and its parameters.

Error Handling
--------------

[](#error-handling)

The package throws exceptions when API requests fail. You can catch these exceptions to handle errors gracefully:

```
use PunterDigital\TCPShield\Exceptions\TCPShieldException;

try {
    $networks = TCPShield::getNetworks();
} catch (TCPShieldException $e) {
    // Handle exception
    echo 'Error: ' . $e->getMessage();
}
```

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance47

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

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

392d ago

### Community

Maintainers

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

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/punterdigital-tcpshield/health.svg)

```
[![Health](https://phpackages.com/badges/punterdigital-tcpshield/health.svg)](https://phpackages.com/packages/punterdigital-tcpshield)
```

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1344.8k1](/packages/jasara-php-amzn-selling-partner-api)[grantholle/powerschool-api

A Laravel package to make interacting with PowerSchool less painful.

1715.6k1](/packages/grantholle-powerschool-api)

PHPackages © 2026

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