Reference search
Results for "middleware"
Reference results link to the matching section. Follow its prerequisites before using a code extract.
Core Concepts
Middleware
...Middleware receives matched parameters before the handler runs.
Production Checklist
Sessions, HTTPS, And Middleware
...Keep root security headers, request limits, and CSRF middleware. Verify admin child middleware and cookie-authenticated API tokens. Sessions start when authentication/flash/CSRF needs them; public pages can remain session-free. Do not remov...
File-Based Routing
Middleware And Visibility
...Root middleware runs first; child directories add their own middleware. Children cannot remove a parent's protection. See Middleware . Files and directories whose names start with _ or . are private. Reusable classes belong in src/Actions o...
Middleware
Middleware
Middleware runs before and after a selected route handler. Use it for request gates such as authentication, authorization, request limits, and response headers. In 0.4.1, middleware is declared in route-directory _middleware.php files, not ...
Recommended App Architecture
Recommended App Architecture
Keep framework files separate from application behavior. In 0.4.1, pages and HTTP handlers share one private Views tree; classes and browser helpers remain ordinary app-owned code. Actions is a convention, not a special framework feature. A...
Route Cache
Reliability
...Missing handler or middleware files fail closed rather than executing another route. If the cache location is unwritable, discovery falls back to current files. Still give the PHP process appropriate cache permissions and monitor logs. Do n...
CLI Guide
Inspect Routes
Shows discovered URLs, methods, relative files, HEAD fallbacks, and inherited middleware. It uses current files even when production has a cached route map. It does not execute handlers/middleware or change the cache.
Errors And Debugging
Errors And Debugging
First identify whether the request reaches PHP, the router, middleware, or the handler. Do not disable protection to make an error disappear.
Dynamic View Guide
Layout Data And Request Attributes
Direct pages/layouts receive the middleware-adjusted $request and escaped $metadata array. A variable set in a direct page is not available in its header/footer. Explicit templates and layouts receive the variables passed to Responses::view...
Request Handlers
Incoming Request URLs
...The router still matches its path, not its origin: Use getPath() for path comparisons and middleware gates. Casting the whole URI to a string is no longer a reliable path-only comparison. Encoded paths and queries are preserved; hostless in...
Request Lifecycle
Request Lifecycle
...4 Middleware Root-to-child middleware can return early or delegate to the next handler. 5 Page or handler A direct GET renders with metadata/layouts/scripts; a callable coordinates modules and returns a response. 6 Emitter ResponseEmitter s...
Security Guide
Security Guide
Security middleware is declared in src/Views/_middleware.php . Keep framework protection and add app-specific authorization in child directories or services.
Authentication, Sessions And Flash Messages
Login And Logout
...2 Verify the POST CSRF middleware validates the request; your handler validates input and verifies a stored password hash. 3 Store identity Start the session, rotate its ID, and store the database user ID, never a submitted role. 4 Protect ...
Static View Guide
Understand The Rendering Flow
...2 Middleware Inherited request gates run before any page code. 3 Metadata Root and about metadata merge into the escaped $metadata array. 4 Page The GET file executes once and produces the content. 5 Layout Nearest header and footer surroun...
Testing An App
Route Smoke Test
...The router test exercises middleware and handlers, not the front controller's parsing or HTTP emission; add an HTTP check for those boundaries. For JSON integration requests, use RequestFactory::fromGlobals() or set withParsedBody($payload)...
Upgrade Guide
Upgrade Guide
...Review routes/pages, middleware policy, templates, browser tooling, Composer mappings, and bootstrap code before deployment.