Config
Overview
Defines tier pricing, VPS specs, and location rules. This class is the single source of truth for tier data.
Constants
DEFAULT_STARTER_CREDITS (float): Default credits for new customers.
Methods
get_tiers(): arrayreturns tier definitions, including Stripe price IDs and Hetzner types.get_tier(string $tier_id): ?arrayreturns a single tier definition.get_tier_ids(): arrayreturns valid tier IDs.get_hetzner_type(string $tier_id, bool $wants_website = true, string $customer_region = 'us'): ?stringreturns the Hetzner type for a tier/location.get_server_location(bool $wants_website, string $customer_region = 'us'): stringreturnsashorfsn1based on region rules.get_server_config(string $tier_id, bool $wants_website, string $customer_region = 'us'): ?arrayreturns VPS config data used for provisioning.get_included_credits(string $tier_id): floatreturns credits for a tier.get_public_tiers(): arrayreturns tier data safe for public API responses.get_tier_by_price(int $price): ?stringreturns tier ID for a monthly price.get_margin_breakdown(string $tier_id, bool $wants_website): ?arrayreturns pricing/margin breakdown.
Data Sources
spawn_stripe_pricesoption provides Stripe price IDs (keys:vps_starter,vps_pro,vps_business).
Usage
php
$tiers = SpawnConfig::get_tiers();
$server_config = SpawnConfig::get_server_config( 'starter', true, 'us' );php
$public = SpawnConfig::get_public_tiers();Example Tier Definition
php
'starter' => [
'name' => __( 'Starter', 'spawn' ),
'price' => 20,
'description' => __( 'Perfect for personal use', 'spawn' ),
'stripe_price_id' => $prices['vps_starter'] ?? '',
'hetzner_type_us' => 'cpx21',
'hetzner_type_eu' => 'cpx22',
'ram_gb' => 4,
'disk_gb' => 80,
];