> 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/build-your-first-extension/hooks.md).

# Hooks

Under the hooks folder, we have 2 files actions.php and filters.php

```
----->hooks
      |----->actions.php
      |----->filters.php
```

**Actions**

Action is one of the two types of hooks. They provide a way for running a function at a specific point in the execution of miniCal Core. Callback functions for an Action do not return anything to the calling Action hook. You can create a hook in the application/hooks folder, here we have created an actions.php file.\
You can find the list of actions here [miniCal Action list](https://github.com/minical/minical/wiki/The-list-of-the-miniCal-actions).

```php
//file name actions.php
// This is a core action that will be executed when a new reservation is created in miniCal
add_action('add.booking.created', 'your_callback_function_1', 10, 1);
function your_callback_function_1($data) {
    // code here
}


// This is a custom action and can be executed from this extension controllers.
add_action('my-custom-action', 'your_custom_callback_function', 10, 1);
function your_custom_callback_function($data) {
    // code here
}
```

**Filters**

They provide a way for functions to modify data during the execution of the miniCal Core. They are the counterpart to action. You can create a hook in the application/hooks folder, here we have created a filers.php file.

{% code title="filters.php" %}

```php
// This is a custom action and can be executed from this extension controllers.
add_filter('my-custom-filter', 'your_callback_function_2', 10, 1);
function your_callback_function_2($data) {
    
    // start writing code here
    // return $data;
}
```

{% endcode %}


---

# 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/build-your-first-extension/hooks.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.
