> For the complete documentation index, see [llms.txt](https://docs.minical.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.minical.io/build-an-extension/config-folder-files/route-file.md).

# Route File

Routes are responsible for responding to URL requests. Routing matches the URL to the pre-defined routes. Routes in miniCal are defined using the below example:

```
Controller/Method/Parameter/
```

* Controller -is mapped to the controller name that should respond to the URL.
* Method – is mapped to the method in the controller that should respond to the URI request.
* Parameter – this section is optional.

### How to define the route for the extensions

For defining route for extension go to the route.php filer under the config folder of your extension.\
Here is an example for the route file.

```php
$extension_route['list'] = 'show_booking/show_latest_bookings';
```

Use the $extension\_route variable for routes, it's the same as CI routes.

```php
$extension_route['list'] 
```

Here this list is the route name, the URL for this route will look like this "[**https://demo.minical.io/list**](https://demo.minical.io/list)"\
Now, this route is bound with a controller and its method. In the above example, we can see that this list route is bound with **show\_booking controller** and the method of show\_booking controller is "**show\_latest\_bookings**".

### How to pass parameters in route

A typical route with a might look something like this:

```php
//Syntaxt
$extension_route['route_name/:num'] = 'contoller/method/$1';
//example
$extension_route['product/:num'] = 'catalog/product_lookup/$1';
```

In a route, the array key contains the URI to be matched, while the array value contains the destination it should be re-routed to. In the above example, if the literal word “product” is found in the first segment of the URL, and a number is found in the second segment, the “catalog” class and the “product\_lookup” method are instead used.\
\&#xNAN;**(:num) will match a segment containing only numbers.**\
\&#xNAN;**(:any) will match a segment containing any character (except for ‘/’, which is the segment delimiter).**

You can send n-numbers of parameters with a route

```php
$extension_route['route_one'] = 'controller/method';
$extension_route['route_two/(:any)'] = 'controller/method/$1';
$extension_route['route_three/(:any)/(:any)'] = 'controller/method/$1/$2';
$extension_route['route_four/(:any)/(:any)/(:any)'] = 'controller/method/$1/$2/3';
```

Here we have provided the list of basic URLs (CRUD operations)

<table><thead><tr><th width="341" align="center">Syntaxt</th><th>URL</th><th width="385">Route</th><th width="283">Controller</th><th>Method</th></tr></thead><tbody><tr><td align="center">$extension_route['/booking_list'] = 'bookinng_controller/index';</td><td>/booking_list</td><td>$extension_route['/booking_list']</td><td>bookinng_controller</td><td>index</td></tr><tr><td align="center">$extension_route['/booking/create'] = 'bookinng_controller/create';</td><td>/booking/create</td><td>$extension_route['/booking/create']</td><td>bookinng_controller</td><td>create</td></tr><tr><td align="center">$extension_route['/booking/edit/:id'] = 'bookinng_controller/edit';</td><td>/booking/edit/id</td><td>$extension_route['/booking/edit/:id']</td><td>bookinng_controller</td><td>edit</td></tr><tr><td align="center">$extension_route['/booking/delete/:id'] = 'bookinng_controller/delete';</td><td>/booking/delete/id</td><td>$extension_route['/booking/delete/:id']</td><td>bookinng_controller</td><td>delete</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.minical.io/build-an-extension/config-folder-files/route-file.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
