Skip to content

Facade Reference ​

Namespace: Hosni\EdgeTrust\Facades\EdgeTrust

php
use Hosni\EdgeTrust\Facades\EdgeTrust;

proxies(?array $providers = null): array ​

Returns trusted proxy CIDR strings for enabled providers (or a subset), resolved according to the configured mode and cache.

php
$proxies = EdgeTrust::proxies();

$middleware->trustProxies(at: $proxies);

ranges(?array $providers = null): array ​

Returns a map of provider key ⇒ ProxyRangeSet.

php
$sets = EdgeTrust::ranges();
$cloudflare = $sets['cloudflare'] ?? null;

get(string $provider): ?ProxyRangeSet ​

Returns the range set for a single provider, or null.

php
$set = EdgeTrust::get('cloudflare');
$cidrs = $set?->all() ?? [];

sync(?array $providers = null, bool $force = false): array ​

Fetches and caches ranges. Returns a list of SyncResult values.

php
$results = EdgeTrust::sync();
$results = EdgeTrust::sync(['cloudflare'], force: true);

syncOne(string $provider, bool $force = false): SyncResult ​

Sync a single provider.

clear(?string $provider = null): void ​

Clears runtime / last-known-good cache entries (same intent as edge-trust:clear).

php
EdgeTrust::clear();
EdgeTrust::clear('cloudflare');

validate(?string $provider = null): ValidationResult ​

Programmatic validation of resolved ranges.

php
$result = EdgeTrust::validate();

if (! $result->passed) {
    // inspect $result->errors — do not activate bad data
}

registerProvider(string $name, string $providerClass): void ​

Registers a custom provider implementation.

php
EdgeTrust::registerProvider('my-proxy', MyCustomProxyProvider::class);

Call during application boot (for example in a service provider). Also declare the class under custom_providers in config when you want declarative registration.

registeredProviders(): array / providerNames(): array ​

Introspection helpers for registered provider classes and names.

mode(): ProxyMode / status(): array ​

Current resolution mode and a status snapshot (also available via edge-trust:status).

archives(): ArchiveManager / validator(): IpRangeValidator ​

Access lower-level services when needed.

Notes ​

  • Prefer proxies() from middleware / bootstrap so caching and mode rules apply.
  • Do not call remote provider HTTP APIs from the request hot path.

Released under the MIT License.