Članci s tagom #saas
-
Public status pages in PHP SaaS: per-tenant, opt-in, no subdomain required
Sonar status page: /sonar/status/{slug} public route (no auth, `minimal` middleware). sonar_tenant_settings.public_status_page_enabled DEFAULT 0 — 404 until opt-in (slug enumeration defence). sonar_monitors.is_public per-monitor gate. 90-day uptime calendar bucketed in PHP per-monitor-per-day (up/degraded/down). M6: raw probe summary sanitised to type-based label (internal IP leak prevention). Overall status: critical → down, warning → degraded, else up. Solo+ tier gate (status_pages limit).
-
Cron heartbeat monitoring: detecting silent job failures with z-score output analysis
Sonar cron heartbeat: push-first (job pings /sonar/ping/<token>), CronScheduleEvaluator 5-field parser (*, digit, range, step, comma) forward-iterates minute-by-minute to nextExpectedAfter(), isOverdue = now > nextExpected + graceSeconds. missed_ping = WARNING. OutputDiffer: BASELINE_SAMPLE=20, MIN_BASELINE=5, ZSCORE_THRESHOLD=3.0/5.0 (warning/critical), MEDIAN_DROP_FACTOR=0.50/0.01. output_anomaly = WARNING or CRITICAL. Zero content storage — derived metrics only.
-
HTTP monitoring beyond uptime: 4 incident types that catch silent failures
Sonar HTTP probe: 4 incident types — http_down (probe unreachable/timeout), http_status_unexpected (wrong code → WARNING), http_slow (duration > threshold, CRITICAL at 2×, auto-resolves), http_body_mismatch (body_contains substring missing → CRITICAL), schema_drift (SHA256 diff opt-in Pro+, default off). Body cap 1MB, excerpt 512B. FOLLOWLOCATION=false SSRF defence. First probe records baseline silently — no alert.
-
Stripe billing in PHP SaaS: 4 edge cases that bit us in production
Sonar billing: PlanService::PLANS canonical catalog (free/solo $9.99/pro $29/agency $79 + limits enforcement), 4 production fixes — M1 dual-sub guard (redirect to portal), M2 Price ID env rotation fallback (historical DB lookup), M3 event ordering guard (GREATEST last_stripe_event_at), M4 unknown Stripe status preserves access. Trial → Solo limits. invoice.payment_failed = log only, let Stripe dun.
-
Building an infrastructure monitoring SaaS in PHP: 5 monitor types on one stack
Sonar: 5 monitor types (cron heartbeat + output diff, SSL cert expiry, HTTP uptime/body/schema-drift, domain WHOIS expiry, renewal reminder), Telegram-first with inline ack/snooze, incident digest (template, no AI), 4 tiers (free/Solo $9.99/Pro $29/Agency $79), RunMonitorChecksJob every-minute tick with per-tick budget 50 monitors oldest-checked-first, sonar_tenant_settings 1-to-1 per tenant.
-
Croatian fiscal invoicing (fiskalizacija) in PHP: SOAP, PKCS12, ZKI, JIR — the complete guide
Fiskalizacija module: Zakon o fiskalizaciji CIS SOAP over HTTPS with XML-DSig (enveloped, exc-c14n, RSA-SHA1, X509Certificate+IssuerSerial), PKCS12 AES-256 encrypted in DB, ZkiGeneratorService (MD5 of concatenated fields), JIR from CIS response, naknadna dostava retry (FiskNaknadnaJob 30min × 10, 48h legal deadline, Telegram alert), 5 AI agents (FiskAgent draft-only), KPD mandatory 2026-01-01, QR code SVG pure PHP.
-
Stripe integration in PHP without stripe-php: webhook verification from scratch
StripeBridge: zero-dependency Stripe HTTP client (form-encoded + JSON), Idempotency-Key on all POSTs (tenant_id+sha256(email) for customers, customer_id+price_id for checkouts), HMAC-SHA256 webhook verification with hash_equals + 5-min replay window, StripeException::redact() strips emails + digit runs, TLS pinning CURLOPT_SSL_VERIFYPEER=true.
-
One PHP codebase, three MySQL servers: per-domain database routing without code changes
How to route a single PHP codebase to different MySQL databases based on HTTP_HOST — without code changes in any model or controller. The full implementation: ConnectionRouter, strict host validation, TLS to remote DBs, and CLI --connection flag.
-
Trial lifecycle in PHP SaaS: from signup to suspended in three database columns
A 14-day trial managed by three DB columns (plan_status, trial_ends_at, is_public_signup), a daily cron job that flips expired trials to suspended, and middleware that redirects suspended users to the upgrade page. No billing framework required.
-
Domain-driven tenant onboarding: how email domain matching beats invite codes
When a new user signs up with an @company.hr email, they automatically join their company's existing tenant instead of creating a new one. No invite code, no admin action required. How to build email domain matching in PHP with a free-domain blocklist and JSON_CONTAINS.
-
Multi-tenant SaaS in PHP without a multi-tenant framework
Row-level tenancy in PHP using one database, one codebase, and a korisnici_companies table. How currentTenantId() and allowed_modules replaced per-tenant databases and per-tenant codebases — and the two contexts that can never be mixed up.
-
Addons vs modules: the architectural boundary that makes a 60k-line PHP SaaS manageable
How one PHP codebase serves infrastructure monitoring, fiscal invoicing, accounting, and a personal AI assistant without coupling any of them. The addons-vs-modules boundary — what it is, why it matters, and the decision tree I use to decide where new code goes.