Reference search
Results for "routes"
Reference results link to the matching section. Follow its prerequisites before using a code extract.
From the matching guide
Create Your First Route
From the project root, you can run: The first command creates src/Views/hello.get.php . Replace its contents with: Open /hello . This example returns a callable; that callable receives the request and returns a PSR response . It must not pr...
php coriander make:route hello
php coriander routes:list
File-Based Routing
Create Your First Route
From the project root, you can run: The first command creates src/Views/hello.get.php . Replace its contents with: Open /hello . This example returns a callable; that callable receives the request and returns a PSR response . It must not pr...
CLI Guide
Create Routes And Views
The route generator defaults to GET and creates a callable method file under src/Views . Files are discovered automatically; no registration follows. The view generator creates a direct GET page: make:view articles/show creates src/Views/ar...
Core Concepts
Routes
...Discovery does not execute every route file.
Errors And Debugging
Route 404 Or 405
...src/Views/about.get.php means GET /about; a view or action class alone is not a route. index.get.php represents its directory's root. 404 means no path or a missing application record. 405 means a path exists but does not accept that method...
Security Guide
Route And Template Safety
...Filenames with private prefixes are not routes. View paths must be normalized relative names under src/Views . Do not build them from raw request values. The renderer escapes string data recursively in arrays; objects, URL validation, and J...
Sitemap
Create A Sitemap Route
You can use: Or create src/Views/sitemap.xml.get.php : Replace https://example.com with your public site URL. Although the method is named addDynamicPage() , it accepts fixed URLs too. Add public article URLs from a repository when needed. ...
Testing An App
Route Smoke Test
Smoke tests check that important public routes still respond after framework updates. Prefer focused route smoke tests over browser-heavy tests for basic coverage. Bootstrap the test's environment, configuration, and autoloaders first. Use ...
Upgrade Guide
Move Routes And Their Protection Together
Move method files from src/Routes into corresponding paths under src/Views . Move every _middleware.php with them, including the root policy and nested admin gates. Resolve overlapping files before moving. Use exact src/Views casing on Linu...
Route Cache
Route Cache
CorianderPHP 0.4.1 caches the discovered route map automatically in production. This replaces controller-cache generation.
Database Patterns
Create The Write Service
...This usage is an extract, not a publicly writable route: All statements run on the same PDO connection supplied by DatabaseHandler::getPDO() . Do not construct a new handler for each write or close it inside the transaction. SQLManager can ...
Dynamic View Guide
Separate Request Flow From Rendering
...Responses::view('articles/[id].get') is invalid: method files must be dispatched by the router.
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...
Install CorianderPHP
Next Steps
...After installation, create your first route and view: Routing Request Handlers Views Recommended App Architecture
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 ...
Custom Module Guide
Call It From A Handler
Replace src/Views/posts.get.php with this complete handler: The router calls the handler, the handler calls your repository, and the repository uses the framework database API. The handler chooses the JSON response; the repository knows not...
Production Checklist
Document Root And Private Files
...This keeps src/Views , routes, environment files, database, and framework source outside direct web access. If your host serves the project root, use PUBLIC_URL_PREFIX=/public and explicit Apache/nginx deny rules before static-file/applicat...
Request Lifecycle
Request Lifecycle
...3 Router Router::handle() selects a discovered method file and assigns path parameters. 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/scr...
Static View Guide
Check Your Work
Confirm GET and HEAD /about appear. Open the page and inspect its title. If the URL is 404, check file casing and the method suffix, not the template contents. The homepage is src/Views/index.get.php . For images and public files, use Asset...