Članci s tagom #multi-tenant
-
Per-tenant AI usage tracking in PHP: attributing every LLM token to its tenant
Two tracking systems: ai_usage_daily (day-level aggregates for budget monitoring, composite PK on date+tenant+provider+model) and limai_token_usage (per-call rows with execution_id for agent log correlation). tenant_id is the required first parameter in every write path — silent attribution bugs aren't possible.
-
Building a WAF in PHP: per-tenant attack attribution that Cloudflare doesn't do
BORNAsecurity: a PHP WAF that knows which tenant is being attacked. FCrDNS-verified crawler bypass, 5σ behavioral anomaly detection, attack chain reconstruction across tenants, self-tuning rules via operator feedback, and a PoW CAPTCHA that requires no Google. No Cloudflare subscription needed.
-
APM in PHP without a SaaS vendor: endpoint profiling from the middleware layer
LUKAmonitoring captures every request's query count, timing, and memory from a priority-5 middleware. p50/p95/p99 per route, N+1 detection, Cohen's d query regression, and a cross-addon incident correlator that spots DDoS-via-expensive-query and breach-with-service-degradation. No Datadog subscription.
-
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.