### Implement Ajax controller logic
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Example controller setup for handling Ajax requests. Ensure the view template is set to NULL to return only the partial content.
```php
page = (new Usuario)->displayUsers($page);
}
}
```
--------------------------------
### HTML Output Example
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Example of the HTML structure generated by the Form helpers.
```html
```
--------------------------------
### Create a Greeting Controller
Source: https://github.com/kumbiaphp/documentation/blob/master/en/controller.md
This is a basic example of a controller class that extends AppController. Ensure the file is named `greeting_controller.php` and the class is `GreetingController`.
```php
id = 2;
$album->name = 'Going Under';
$album->date = '2017-01-01';
$album->value = 25;
$album->artist_id = 123;
$album->status = 'A';
$album->save();
```
--------------------------------
### Cache Output Buffers
Source: https://github.com/kumbiaphp/documentation/blob/master/en/parent-class.md
Use start and end methods to cache fragments of views.
```php
start('+1 day', 'saludo')): ?>
Hello php echo $user? > php Cache:driver()-> end()? >
```
--------------------------------
### Define a Cache Console Class
Source: https://github.com/kumbiaphp/documentation/blob/master/en/console.md
Example of a console class structure using the Cache library to clear cache groups or drivers.
```php
& Lt;? Php
Load :: lib ('cache');
Class CacheConsole
{
Public function clean ($ params, $ group = FALSE)
{
// get the cache driver
If (isset ($ params ['driver'])) {
$ Cache = Cache :: driver ($ params ['driver']);
} Else {
$ Cache = Cache :: driver ()
}
// clear the cache
If ($ cache-> clean ($ group)) {
If ($ group) {
Echo "-> The group $ group has been cleaned, PHP_EOL;
} Else {
Echo "-> The cache has been cleared", PHP_EOL;
}
} Else {
Throw new KumbiaException ('Unable to delete content');
}
}
}
```
--------------------------------
### Set File Permissions for Web Server
Source: https://github.com/kumbiaphp/documentation/blob/master/en/installing-kumbiaphp-apache-nginx.md
Set ownership and permissions for KumbiaPHP files and directories to ensure the web server user ('www-data') has access. Directories get 755, and files get 644 permissions.
```bash
sudo chown -R www-data:www-data /var/www/kumbiafw
sudo find /var/www/kumbiafw -type d -exec chmod 755 {} \;
sudo find /var/www/kumbiafw -type f -exec chmod 644 {} \;
```
--------------------------------
### Implement Pagination in Model
Source: https://github.com/kumbiaphp/documentation/blob/master/en/appendix.md
Example of using the paginate method within an ActiveRecord model.
```php
paginate("page: $page", 'per_page: 5');
}
}
```
--------------------------------
### Apache Virtual Host Configuration
Source: https://github.com/kumbiaphp/documentation/blob/master/en/installing-kumbiaphp-apache-nginx.md
Create an Apache virtual host configuration file for KumbiaPHP. Ensure 'kumbia.fw' is replaced with your desired local domain and the DocumentRoot points to your KumbiaPHP installation.
```apache
ServerName kumbia.fw
DocumentRoot /var/www/kumbiafw/default/public
AllowOverride All
Require all granted
ErrorLog ${APACHE_LOG_DIR}/kumbiafw-error.log
CustomLog ${APACHE_LOG_DIR}/kumbiafw-access.log combined
```
--------------------------------
### Navigate to Web Directory
Source: https://github.com/kumbiaphp/documentation/blob/master/en/installing-kumbiaphp-apache-nginx.md
Change to the directory where project files will be stored.
```bash
cd /var/www
```
--------------------------------
### Enable Nginx Site and Test Configuration
Source: https://github.com/kumbiaphp/documentation/blob/master/en/installing-kumbiaphp-apache-nginx.md
Enable the Nginx KumbiaPHP site, test the Nginx configuration, and reload Nginx.
```bash
sudo ln -s /etc/nginx/sites-available/kumbiafw /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
```
--------------------------------
### Create a Basic View
Source: https://github.com/kumbiaphp/documentation/blob/master/en/first-app.md
Define the HTML output for the controller action in a .phtml file.
```html
Hello KumbiaPHP!
```
--------------------------------
### Save and Retrieve Cache Data
Source: https://github.com/kumbiaphp/documentation/blob/master/en/parent-class.md
Check for cached data and save it if it does not exist using the get and save methods.
```php
get('saludo'); if(!$data) { Cache::driver()->save('Hola', '+1 day'); } echo $data;
```
--------------------------------
### Define Database Connection Configuration
Source: https://github.com/kumbiaphp/documentation/blob/master/en/active-record.md
Shows the structure of the databases.php configuration file for defining multiple environment connections.
```php
[
// configuration array
],
// Connection parameters for production
'production' => [
// configuration array
],
];
```
```php
[
'host' => 'localhost',
'username' => 'root',
'password' => 'root',
'name' => 'test',
'type' => 'mysql',
'charset' => 'utf8',
//'dsn' => '',
//'pdo' => 'On',
],
];
```
--------------------------------
### Enable Apache Site and Rewrite Module
Source: https://github.com/kumbiaphp/documentation/blob/master/en/installing-kumbiaphp-apache-nginx.md
Enable the KumbiaPHP virtual host site and the Apache rewrite module, then reload Apache.
```bash
sudo a2ensite kumbiafw.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
```
--------------------------------
### Create and Delete Models
Source: https://github.com/kumbiaphp/documentation/blob/master/en/console.md
Commands to generate or remove application models.
```bash
php ../../core/console/kumbia.php model create simple_auth
```
```bash
php ../../core/console/kumbia.php model delete simple_auth
```
--------------------------------
### Create a New Record with ActiveRecord
Source: https://github.com/kumbiaphp/documentation/blob/master/en/active-record.md
Demonstrates instantiating a model class and saving a new record to the database.
```php
idcode = "808111827-2";
$client->name = "XYZ COMMUNICATIONS COMPANY";
$client->save(); //it creates a new record
```
--------------------------------
### Configure Application Mode
Source: https://github.com/kumbiaphp/documentation/blob/master/en/to-install.md
Sets the PRODUCTION constant to toggle between development and production environments.
```php
const PRODUCTION = false;
```
```php
const PRODUCTION = true;
```
--------------------------------
### Implement Controller Filters
Source: https://context7.com/kumbiaphp/documentation/llms.txt
Use initialize/finalize for global hooks and before_filter/after_filter for controller-specific logic like authentication.
```php
app_name = 'My App';
}
// Runs after any controller executes
protected function finalize()
{
// Cleanup code
}
}
// app/controllers/admin_controller.php
class AdminController extends AppController
{
// Runs before each action in this controller
protected function before_filter()
{
// Check authentication
if (!Auth::is_valid()) {
Flash::error('Please login first');
return Redirect::to('login/');
}
}
// Runs after each action in this controller
protected function after_filter()
{
// Log activity
}
public function dashboard()
{
$this->stats = $this->getStats();
}
}
```
--------------------------------
### Implement URL Routing and Controller Actions
Source: https://context7.com/kumbiaphp/documentation/llms.txt
Map URL patterns to controller methods and handle parameters automatically.
```php
article = (new Articles)->find_first(
"year = '$year' AND month = '$month' AND slug = '$slug'"
);
}
// /articles/category/technology/2
public function category($name, $page = 1)
{
$this->articles = (new Articles)->paginate(
"category = '$name'",
"per_page: 10",
"page: $page"
);
}
}
```
--------------------------------
### Create Custom Console Commands
Source: https://context7.com/kumbiaphp/documentation/llms.txt
Define custom classes in the extensions directory to implement application-specific CLI tasks.
```php
Welcome to KumbiaPHP!
Today's date and time is: = $date ?>
```
--------------------------------
### Console Usage
Source: https://github.com/kumbiaphp/documentation/blob/master/en/console.md
General instructions on how to use the KumbiaPHP console from the terminal.
```APIDOC
## Console Usage
### Description
Instructions on how to execute the KumbiaPHP console dispatcher from the terminal to perform automated tasks.
### Method
Command Line Execution
### Endpoint
`php .../../core/console/kumbia.php [console] [command] [arg] [\--arg_name] = value`
### Parameters
#### Path Parameters
- **console** (string) - Required - The name of the console to run (e.g., cache, model, controller).
- **command** (string) - Optional - The specific command within the console to execute. If not specified, the 'main' command is run.
- **arg** (string) - Optional - Sequential arguments for the command.
- **--arg_name = value** (string) - Optional - Named arguments for the command, prefixed with '--'.
### Request Example
```bash
php .../../core/console/kumbia.php cache clean --driver=sqlite
php kumbia.php cache clean --driver=sqlite --path="/var/www/app"
```
### Response
N/A (Command Line Output)
```
--------------------------------
### Product Index View
Source: https://context7.com/kumbiaphp/documentation/llms.txt
Displays a list of products, including their name and price. Links to individual product detail pages.
```html
```
--------------------------------
### Displaying APP_PATH
Source: https://github.com/kumbiaphp/documentation/blob/master/en/front-controller.md
Outputs the absolute path to the application's app directory.
```php
echo APP_PATH;
// Output: /var/www/kumbiaphp/default/app/
```
--------------------------------
### Accessing Controller and Action Metadata
Source: https://github.com/kumbiaphp/documentation/blob/master/en/controller.md
Demonstrates how to retrieve the current controller name, action name, and URL parameters within an action method.
```php
controller_name; // news
echo $this->action_name; // show
// An array with all parameters sent to the action
var_dump($this->parameters);
}
}
```
--------------------------------
### Create goodbye view with Html helper
Source: https://github.com/kumbiaphp/documentation/blob/master/en/first-app.md
Displays a goodbye message and uses the Html::link helper to generate a dynamic link back to the hello action.
```php
Ops! has gone :(
```
--------------------------------
### Create TestController
Source: https://github.com/kumbiaphp/documentation/blob/master/en/installing-kumbiaphp-apache-nginx.md
Define a basic controller class that extends AppController to handle requests.
```php
date = date('Y-m-d H:i:s');
}
}
```
--------------------------------
### Form::select() with Static Method
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Demonstrates using Form::select with a static method call that accepts parameters to influence data retrieval.
```APIDOC
## Form::select() with Parameters
### Description
Creates an HTML select element using a static method call that can accept parameters to customize the data source.
### Method
Static method call within Form::select
### Endpoint
N/A (Helper function)
### Parameters
- **`reservations.farm_id`** (string) - Name attribute for the select element.
- **`Farms::mySelect(param1, param2, ...)`** (callable) - A static method call that returns an array of objects, each with `id` and `name` properties, to populate the options.
### Request Example
```php
= Form::select('reservations.farm_id', Farms::mySelect(param1, param2, ...)) ?>
```
### Response
#### HTML Output (Example)
```html
```
```
--------------------------------
### Define a Greeting Controller
Source: https://github.com/kumbiaphp/documentation/blob/master/en/first-app.md
Create a controller class inheriting from AppController to handle application logic.
```php
'/app',
'/apps' => '',
'/app/controllers/application.php' => '/app/application.php',
'/app/views/layouts' => '/app/views/templates',
'/app/views/index.phtml' => '/app/views/templates/default.phtml',
'/app/views/not_found.phtml' => '/app/views/errors/404.phtml',
'/app/views/bienvenida.phtml' => '/app/views/pages/index.phtml',
'/app/helpers' => '/app/extensions/helpers',
'/app/models/base/model_base.php' => '/app/model_base.php',
'/app/models/base/' => '',
'/cache' => '/app/cache',
'/config' => '/app/config',
'/docs' => '/app/docs',
'/logs' => '/app/logs',
'/scripts' => '/app/scripts',
'/test' => '/app/test'
```
--------------------------------
### Navigate to Application Directory
Source: https://github.com/kumbiaphp/documentation/blob/master/en/to-install.md
Command to change the terminal working directory to the application folder.
```bash
cd kumbiaphp/default/app
```
--------------------------------
### Form::button Usage
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Creates a standard button element.
```php
echo Form::button('calculate'); // Create a button with the text 'calculate'
```
--------------------------------
### Handle Input and Sessions in PHP
Source: https://context7.com/kumbiaphp/documentation/llms.txt
Access POST/GET request data and manage user session state using the Input and Session classes.
```php
id);
Session::set('cart', ['item1', 'item2']);
$userId = Session::get('user_id');
$cart = Session::get('cart');
if (Session::has('user_id')) {
// User is logged in
}
Session::delete('cart'); // Remove specific key
```
--------------------------------
### Define a Template File
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Create a .phtml file in views/_shared/templates/ to define a new template. This template will be processed in the second step of the view rendering process.
```php
Example Template
Example Template
```
--------------------------------
### Execute Cache Clean Command
Source: https://github.com/kumbiaphp/documentation/blob/master/en/console.md
Cleans the application cache using the specified driver.
```bash
php .../../core/console/kumbia.php cache clean --driver=sqlite
```
```bash
php kumbia.php cache clean --driver=sqlite --path="/ var/www/app"
```
```bash
php .../../core/console/kumbia.php cache clean
```
--------------------------------
### Create a Partial View
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Define reusable view fragments by creating .phtml files in the views/_shared/partials/ directory. These can include elements like headers, footers, or forms.
```php
Greeting Template
```
--------------------------------
### Input Class Method Changes
Source: https://github.com/kumbiaphp/documentation/blob/master/en/appendix.md
Shows the evolution of input handling methods from version 0.5 to beta2, with changes in method naming conventions.
```php
$this->has_post 0.5 => Input:hasPost beta2
```
```php
$this->has_get 0.5 => Input:hasGet beta2
```
```php
$this->has_request 0.5 => Input:hasRequest beta2
```
```php
$this->post 0.5 => ' Input:post beta2
```
```php
$this->get 0.5 => ' Input:get beta2
```
```php
$this->request 0.5 => 'Input::request beta2
```
--------------------------------
### Define New Database Connection Configuration
Source: https://github.com/kumbiaphp/documentation/blob/master/en/active-record.md
Configure a new database connection in `config.php`. This array defines connection parameters for a specific database, which can then be referenced by models.
```php
[
'host' => 'superserver',
'username' => 'myusername',
'password' => 'Y)vahu}UvM(jG]#UTa3zAU7',
'name' => 'newdatabase',
'type' => 'mysql',
'charset' => 'utf8',
//'dsn' => '',
//'pdo' => 'On',
],
];
```
--------------------------------
### Include CSS Files with Tag::css() and Html::includeCss()
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Adds CSS files to a list for inclusion. Html::includeCss() then renders these linked resources.
```php
Tag:css('welcome'); //Put in list a CSS (app/public/css/welcome.css)
echo Html:includeCss; //Add linked resources of the class in the project
```
--------------------------------
### Select a Template in Controller
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Use View::template() in your controller to specify which template file to use for rendering. Pass the template name without the extension.
```php
php echo Form:text('login')? >
php echo Form:pass('password')? >
```
--------------------------------
### Include CSS File
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Adds a CSS file to the list of resources to be included in the project. Assumes the file is located in app/public/css/.
```php
Tag:css('welcome');
echo Html:includeCss;
```
--------------------------------
### Configure Trusted IPs for Exception Display
Source: https://github.com/kumbiaphp/documentation/blob/master/en/configuration.md
The `exception.php` file configures which IP addresses can view detailed exception traces instead of a generic 404 error. This is primarily useful during development for debugging.
```php
[]
];
```
--------------------------------
### Define GreetingController actions
Source: https://github.com/kumbiaphp/documentation/blob/master/en/first-app.md
Defines the GreetingController class with hello and goodbye methods.
```php
date = date("Y-m-d H:i");
$this->name = $name;
}
/**
* Method to say goodbye
*/
public function goodbye() {
}
}
```
--------------------------------
### Generic View for Blog Posts
Source: https://github.com/kumbiaphp/documentation/blob/master/es/controller.md
Handles article rendering and 404 partial inclusion when an article is not found.
```php
if (!$article) {
View::partial('articles/404');
return 1;
}
```
--------------------------------
### Html Helper Methods
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Methods for managing external link resources and head link queues in KumbiaPHP.
```APIDOC
## Html::headLinkResource($resource, $attrs = NULL)
### Description
Adds an external link element to the head link queue.
### Parameters
- **resource** (string) - Required - Location of the resource in public.
- **attrs** (string) - Optional - Additional HTML attributes.
### Request Example
Html::headLinkResource('favicon.ico', "rel='shortcut icon', type='image/x-icon'");
---
## Html::includeHeadLinks()
### Description
Outputs the links previously added to the queue.
### Request Example
echo Html::includeHeadLinks();
```
--------------------------------
### Execute KumbiaPHP Console Commands
Source: https://context7.com/kumbiaphp/documentation/llms.txt
Use the command line interface for managing models, controllers, and cache operations.
```bash
# Navigate to app directory
cd kumbiaphp/default/app
# Create a new model
php ../../core/console/kumbia.php model create product
# Delete a model
php ../../core/console/kumbia.php model delete product
# Create a new controller
php ../../core/console/kumbia.php controller create product_catalog
# Delete a controller
php ../../core/console/kumbia.php controller delete product_catalog
# Clean all cache
php ../../core/console/kumbia.php cache clean
# Clean specific cache group
php ../../core/console/kumbia.php cache clean my_group
# Clean cache with specific driver
php ../../core/console/kumbia.php cache clean --driver=sqlite
# Remove specific cache item
php ../../core/console/kumbia.php cache remove item_id group_name
```
--------------------------------
### Create Forms with Form Helper
Source: https://context7.com/kumbiaphp/documentation/llms.txt
Build forms using model-based naming conventions for automatic data binding. Supports various input types, select dropdowns, and buttons.
```php
id);
echo Form::file('document');
// Checkboxes and Radio buttons
echo Form::check('user.active', '1', null, true); // Checked
echo Form::check('user.newsletter', '1', null, false);
echo Form::radio('user.gender', 'male', null, true);
echo Form::radio('user.gender', 'female');
// Select dropdowns
$statuses = ['active' => 'Active', 'inactive' => 'Inactive'];
echo Form::select('user.status', $statuses);
echo Form::select('user.status', $statuses, "class='form-select'", 'active');
// Select with numeric range
echo Form::select('reservation.guests', range(1, 10));
// Select from model data
echo Form::select('order.product_id', Products::getSelectOptions());
// Using model constants
class Order extends ActiveRecord {
const STATUS = [
'pending' => 'Pending',
'processing' => 'Processing',
'completed' => 'Completed'
];
}
echo Form::select('order.status', Order::STATUS);
// Buttons
echo Form::submit('Save');
echo Form::submit('Submit', "class='btn btn-primary'");
echo Form::button('Calculate', "onclick='calculate()'");
echo Form::reset('Clear Form');
echo Form::submitImage('buttons/save.png');
echo Form::close();
```
--------------------------------
### Download KumbiaPHP Archive
Source: https://github.com/kumbiaphp/documentation/blob/master/en/installing-kumbiaphp-apache-nginx.md
Download the latest KumbiaPHP .tar.gz file from the official repository.
```bash
wget https://github.com/KumbiaPHP/KumbiaPHP/archive/v1.2.1.tar.gz
```
--------------------------------
### Create Link using Html Helper
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Use the Html::link() helper to generate an HTML anchor tag. Specify the action path, the link text, and any additional attributes.
```php
echo html:link('pages/show/kumbia/status'_,'Configuration'); //shows a link with the text 'Configuration'
```
--------------------------------
### Form::select with Model Methods
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Using object instances or static methods from a model to populate select options.
```php
= Form::select('reservations.farm_id', (new Farms)->mySelect()) ?>
```
```php
= Form::select('reservations.farm_id', Farms::mySelect()) ?>
```
--------------------------------
### Controller Console
Source: https://github.com/kumbiaphp/documentation/blob/master/en/console.md
Commands for manipulating application controllers.
```APIDOC
## Controller Console
### Description
It allows you to manipulate the application controllers.
### Commands
#### `create [controller]`
##### Description
Create a controller using as a basis the template located in the 'core/console/generators/controller.php'.
##### Method
Command Line Execution
##### Endpoint
`php ../../core/console/kumbia.php controller create [controller]`
##### Parameters
###### Path Parameters
- **controller** (string) - Required - Controller name in smallcase.
##### Request Example
```bash
php ../../core/console/kumbia.php controller create product_sales
```
#### `delete [controller]`
##### Description
Delete controller.
##### Method
Command Line Execution
##### Endpoint
`php ../../core/console/kumbia.php controller delete [controller]`
##### Parameters
###### Path Parameters
- **controller** (string) - Required - Controller name in smallcase.
##### Request Example
```bash
php ../../core/console/kumbia.php controller delete product_sales
```
```
--------------------------------
### Create and Edit CRUD Forms
Source: https://context7.com/kumbiaphp/documentation/llms.txt
Use Form and Html helpers to generate product creation and editing views with validation-ready inputs.
```php
= Form::submit('Update Product', "class='btn btn-primary'") ?>
= Html::link('products/', 'Cancel', "class='btn btn-secondary'") ?>
= Form::close() ?>
```
--------------------------------
### User Model with Auth2
Source: https://github.com/kumbiaphp/documentation/blob/master/en/parent-class.md
Model implementation for user authentication using the Auth2 library.
```php
php
The auth2 library loading
Load: lib ('auth2');
class user extends ActiveRecord
{
/ * * Log * * / public function login() {/ / Gets the adapter $auth = Auth2:factory('model');} Model to be used for $auth - > setModel ('user'); if($auth->identify()) return true; Flash:error($auth->getError()); return false; } / * * End * * / public function logout() {Auth2:factory('model') - > logout();} } / * * Check if this authenticated user * @return boolean * / public function logged() {return Auth2:factory('model') - > isValid();} }
}
```
--------------------------------
### Group Views in Directories
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Organize views into subdirectories using the '/' separator in the route. This allows for better structure and management of view files.
```php
```
```php
= Js::link('user/delete/5', 'Delete', 'Are you sure you want to do this?', 'b_delete') ?>
```
--------------------------------
### Js::submit()
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Creates a submit button that displays a confirmation dialog upon clicking.
```APIDOC
## Js::submit()
### Description
Creates a submit button that shows a confirmation dialog when you press it.
### Parameters
- **$text** (string) - Text to show
- **$confirm** (string) - Confirmation message (default: 'Are you sure?')
- **$class** (string) - Additional classes for the link (optional)
- **$attrs** (string) - Additional attributes (optional)
### Method Signature
`Js::submit ($text, $confirm = 'Are you sure?', $class = NULL, $attrs = NULL)`
### Request Example
```php
// If you'd like to apply a style class to the link you must specify it in the $class argument.
= Js::submit('Save', 'Are you sure?', 'save_button') ?>
```
```
--------------------------------
### Create confirmation image buttons with Js::submitImage
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Generates an image-based button that triggers a confirmation dialog. Requires a valid path to the image asset.
```php
//If you want to apply a style class to the link you must indicate so in the $class argument.
= Js::submitImage('buttons/save', 'Are you sure?', 'save_button') ?>
```
--------------------------------
### Render Punbb Pagination Partial
Source: https://github.com/kumbiaphp/documentation/blob/master/en/appendix.md
Renders the Punbb style pagination partial.
```php
View::partial('paginators/punbb', false, array('page' => $page, 'show' => 8, 'url' => 'user/list'));
```
--------------------------------
### Router Class Method Changes
Source: https://github.com/kumbiaphp/documentation/blob/master/en/appendix.md
Compares Router class methods between version 0.5 and beta1/beta2, noting changes in redirection and routing functionalities.
```php
$this->route_to 0.5 => 'Router::route_to beta1 y beta2
```
```php
$this->redirect 0.5 => Router::redirect beta2
```
--------------------------------
### Include Image using Html Helper
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Use the Html::img() helper to generate an HTML image tag. Specify the image path, alt attribute, and any additional attributes.
```php
echo Html:img('spin.gif'_,'an_imagen'); //the image spin.gif located inside of "/ public/img /"
//with alt artibute 'an image'
```
--------------------------------
### Generate HTML Elements with Html Helper
Source: https://context7.com/kumbiaphp/documentation/llms.txt
Use the Html helper to generate links, images, lists, and manage CSS/meta tags. Ensure assets are queued before calling include methods.
```php
'Home Page', 'about' => 'About Us'];
echo Html::lists($menu, 'ol');
// Gravatar
echo Html::gravatar('user@example.com', 'User Avatar', 80);
echo Html::link(Html::gravatar('user@example.com'), 'profile/');
// CSS and Meta tags
Tag::css('styles'); // Queue CSS file
Tag::css('print', 'print'); // CSS with media type
echo Html::includeCss(); // Output all queued CSS
Html::meta('KumbiaPHP Team', "name='author'");
Html::meta('text/html; charset=UTF-8', "http-equiv='Content-Type'");
echo Html::includeMetatags();
// External links
Html::headLink('https://example.com/feed.xml', "rel='alternate' type='application/rss+xml'");
Html::headLinkResource('favicon.ico', "rel='shortcut icon'");
echo Html::includeHeadLinks();
```
--------------------------------
### Cache Console
Source: https://github.com/kumbiaphp/documentation/blob/master/en/console.md
Commands for managing the application's cache.
```APIDOC
## Cache Console
### Description
This console allows you to perform control over the cache of the application.
### Commands
#### `clean [group] [--driver]`
##### Description
Allows you to clean the cache.
##### Method
Command Line Execution
##### Endpoint
`php .../../core/console/kumbia.php cache clean [group] [--driver]`
##### Parameters
###### Path Parameters
- **group** (string) - Optional - Group name of cache items that will be deleted. If not specified, then all cache is cleaned.
###### Named Arguments
- **driver** (string) - Optional - Driver cache corresponding to the cache cleaning (nixfile, file, sqlite, APC). If not specified, the cache manager takes the default.
##### Request Example
```bash
php .../../core/console/kumbia.php cache clean
```
#### `remove [id] [group]`
##### Description
Removes an element from the cache.
##### Method
Command Line Execution
##### Endpoint
`php ../../core/console/kumbia.php cache remove [id] [group]`
##### Parameters
###### Path Parameters
- **id** (string) - Required - ID of the element in the cache.
- **group** (string) - Optional - Name of the group to which the element belongs. If no value is specified, then the 'default' group is used.
###### Named Arguments
- **driver** (string) - Optional - Driver cache corresponding to the cache cleaning (nixfile, file, sqlite, APC).
##### Request Example
```bash
php ../../core/console/kumbia.php cache remove viewclient my_views
```
```
--------------------------------
### Form::select with Static Method
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Uses a static method with parameters to populate a select dropdown.
```php
= Form::select('reservations.farm_id', Farms::mySelect(param1, param2, ...)) ?>
```
--------------------------------
### Model Console
Source: https://github.com/kumbiaphp/documentation/blob/master/en/console.md
Commands for manipulating application models.
```APIDOC
## Model Console
### Description
It allows you to manipulate the application models.
### Commands
#### `create [model]`
##### Description
Create a model using as a base the template located at "core/console/generators/model.php".
##### Method
Command Line Execution
##### Endpoint
`php ../../core/console/kumbia.php model create [model]`
##### Parameters
###### Path Parameters
- **model** (string) - Required - Model name in smallcase.
##### Request Example
```bash
php ../../core/console/kumbia.php model create simple_auth
```
#### `delete [model]`
##### Description
Delete a model.
##### Method
Command Line Execution
##### Endpoint
`php ../../core/console/kumbia.php model delete [model]`
##### Parameters
###### Path Parameters
- **model** (string) - Required - Model name in smallcase.
##### Request Example
```bash
php ../../core/console/kumbia.php model delete simple_auth
```
```
--------------------------------
### Render Simple Pagination Partial
Source: https://github.com/kumbiaphp/documentation/blob/master/en/appendix.md
Renders the simple style pagination partial.
```php
View::partial('paginators/simple', false, array('page' => $page, 'url' => 'user/list'));
```
--------------------------------
### Form Helper Methods
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Methods for creating and managing HTML forms and input fields.
```APIDOC
## Form::open($action = NULL, $method = 'POST', $attrs = NULL)
### Description
Creates an opening form tag.
---
## Form::openMultipart($action = NULL, $attrs = NULL)
### Description
Creates a multipart form tag for file uploads.
---
## Form::text($field, $attrs = NULL, $value = NULL)
### Description
Creates an input field of type text. If the field name contains a dot (e.g., model.field), it generates name="model[field]" and id="model_field".
---
## Form::label($text, $field, $attrs = NULL)
### Description
Creates a label and associates it with a specific field.
```
--------------------------------
### Form::submit() - Submit Button
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Creates a standard HTML submit button for a form.
```APIDOC
## Form::submit()
### Description
Creates a standard HTML submit button for the current form.
### Method
`Form::submit($text, $attrs = NULL)`
### Parameters
- **`$text`** (string) - The text content of the submit button.
- **`$attrs`** (string, optional) - Additional HTML attributes for the button.
### Request Example
```php
echo Form::submit('send'); //Create a button with the text 'send'
```
### Response
Generates an HTML input element of type 'submit'.
```
--------------------------------
### Js::submitImage()
Source: https://github.com/kumbiaphp/documentation/blob/master/en/view.md
Creates an image button that displays a confirmation dialog when clicked.
```APIDOC
## Js::submitImage()
### Description
Creates an image button that when pressed displays a confirmation dialog.
### Parameters
- **$img** (string) - Path to image
- **$confirm** (string) - Confirmation message (default: 'Are you sure?')
- **$class** (string) - Additional classes for the link (optional)
- **$attrs** (string) - Additional attributes (optional)
### Method Signature
`Js::submitImage($img, $confirm = 'Are you sure?', $class = NULL, $attrs = NULL)`
### Request Example
```php
//If you want to apply a style class to the link you must indicate so in the $class argument.
= Js::submitImage('buttons/save', 'Are you sure?', 'save_button') ?>
```
```