# Web.php

The `Web.php` file is used to define routes for the web interface of the application. These routes are typically used to render HTML pages for end users.

## Characteristics

* **Stateful**: Web routes often maintain state between requests, such as user sessions.
* **HTML**: Web routes typically return data in HTML format.
* **Authentication**: Web routes often use session or cookie-based authentication methods.
* **Middleware**: Web routes often use middleware to handle tasks such as authentication, authorization, and logging.

## When to Use?

* When you need to render HTML pages for end users.
* When you need to handle requests from web browsers.
* When you need to use features like sessions or cookies to maintain user state.

## Example

<pre class="language-php"><code class="lang-php"><strong>// Ussing manual
</strong>$routes->get('users/', 'UsersController::list');
$routes->get('users/(:num)', 'UsersController::view:$1');
$routes->post('users/create', 'UsersController::create');
$routes->put('users/edit/(:num)', 'UsersController::edit:$1');
$routes->delete('users/delete/(:num)', 'UsersController::delete:$1');
<strong>
</strong><strong>// Apply Middleware
</strong><strong>$router->get('admin', 'Backend\HomeController::index', [\App\Middleware\AuthMiddleware::class,\App\Middleware\RolesMiddleware::class];
</strong>$routes->get('account/profile', 'Backend\AuthController::profile',[\App\Middleware\AuthMiddleware::class]);
$routes->get('account/logout', 'Backend\AuthController::logout',[\App\Middleware\AuthMiddleware::class]);
$routes->get('account/(:any)/(:any)', 'Backend\AuthController::$1:$2',[\App\Middleware\NoauthMiddleware::class]);
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cmsfullform.com/documents/uri-routing/web.php.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
