Članci s tagom #framework
-
How I built a PHP framework solo in 18 months: decisions that kept it manageable
18 months building the Shinobi Apps framework solo: zero runtime Composer deps (vendor/ not shipped), 4-prefix autoloader, zero BC policy (framework moves with production needs not arbitrary API stability), addon isolation (CSS/PHP stays in addon folder, not in core), forward-only migrations (no down/rollback), PHPStan level 5 + Psalm taint analysis as global tools. Sustainable for one person = the primary constraint.
-
Active Record in PHP without an ORM: how the Shinobi Apps framework's Model works
An Active Record implementation with QueryBuilder, typed attribute casts, soft delete, eager loading with whereIn batching, and model lifecycle events — without Doctrine, Eloquent, or any Composer package. What zero-dependency means for the database layer.
-
PHP migration system: forward-only, one file per change, shared-host compatible
SQL-only migrations, no PHP interface. Forward-only with no down() method. One logical change per file. Checksum verification on re-run. Shared-host compatible: no information_schema access needed, MySQL 5.5+ syntax only. Works across multiple databases in one command.
-
2FA and magic links in PHP: TOTP and passwordless login without packages
Pure-PHP RFC 6238 TOTP: HMAC-SHA1 with dynamic truncation, base32 encode/decode, ±30-second drift window. Magic link login: 32-byte random token, 15-minute TTL, hash stored, raw in URL. Neither requires a Composer package.
-
PHP session security: database-backed sessions, salted fingerprinting, and deferred writes
Database-backed sessions only (file driver removed). Salted SHA-256 fingerprint that an attacker can't reproduce without server-side salt. Deferred write: session lock released immediately after start(), in-memory delta flushed at end of request. flock-based regeneration lock for parallel requests.
-
Rate limiting in PHP: two-lane defense against DDoS and brute force
One rate limiter, two lanes per protected route. Lane 1 counts every POST per IP (anti-DDoS, high threshold). Lane 2 counts only failed auth attempts per email (anti-brute-force, 5 tries). Sliding window with weighted previous window. BORNA enrichment via events.
-
Content Security Policy in PHP: the nonce approach that actually works
A strict CSP with per-request nonces, no 'unsafe-inline', and no X-XSS-Protection (which causes more bugs than it prevents). How we handle dynamic styling in a CSP-compliant way: CSS custom properties via setProperty() instead of inline style attributes.
-
CSRF protection in PHP without a framework: rotating tokens, grace periods, and the @csrf directive
How the Shinobi Apps framework implements CSRF protection: bin2hex(random_bytes(32)) tokens stored in session, 30-minute rotation with a 10-minute grace period for tabs left open, hash_equals() for timing-safe comparison, and an @csrf directive that outputs window.CSRF_TOKEN instead of a meta tag.
-
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.
-
Lazy vs eager bootstrap in PHP: the production incident that taught me the hard way
Three bootstrap patterns for PHP service registration — pure eager, pure lazy, and the split approach. Why lazy sounds smart, why it breaks cross-cutting hooks, and what the 2026-04-28 incident looked like at 11pm.
-
Inside a PHP framework: 20 subsystems, a 5-stage bootstrap, and a request lifecycle you can read in one sitting
What happens between a browser request hitting Apache and your controller method running? Walk through the Shinobi Apps framework architecture: 5-stage bootstrap, 8-layer middleware pipeline, 20 core subsystems, and a request lifecycle that fits in your head.
-
The custom PHP autoloader: a 4-prefix lookup table and one is_file() call
A complete PSR-4-compatible autoloader in 50 lines. Four namespace prefixes, one is_file() check per class load, and OPcache doing the actual caching. No class-map generation step, no Composer runtime, no regex. Here's exactly how it works.
-
Why I built a zero-dependency PHP framework in 2025
Composer is the gold standard. Symfony and Laravel are mature. So why ship a custom PHP 8.3 framework with zero composer dependencies in 2025? The honest answer — and what it actually cost me.