ArtiGrid Builder Pro
Complete Documentation — CLI Reference & Visual Builder
Two ways to generate the same ArtiGrid code: from the command line, or visually.
How Arco and ArtiGrid Builder Pro fit together
This documentation covers two tools that produce the same end result — working ArtiGrid code — through two different workflows.
| Tool | Workflow | Best for |
|---|---|---|
| Arco CLI | Terminal commands (php arco make:crud …) that scaffold controllers, views, models, routes, and menu items into your project. |
Repeatable scaffolding, scripting, version-controlled generation, full MVC wiring. |
| ArtiGrid Builder | A visual, point-and-click interface where you configure a table and a render mode, then copy the generated PHP. | Exploring options visually, one-off snippets, fine-tuning a single grid before pasting it in. |
php arco make:crud Users users --columns=id,name,email --modal produces essentially the same $grid->table('users')->crudCol([...])->modal() chain you would assemble by clicking through the Builder. Learn the chain once and you can read, tweak, or extend output from either tool.
A common flow: use the Arco wizard or make:crud to scaffold the full page and route, then open the Builder when you want to experiment with extra ArtiGrid features (comboboxes, calendar mode, charts) before folding them back into the generated controller.
Command Overview
Arco is the Artigrid command-line console. Run all commands from the project root:
php arco <command> [arguments] [options]
Initializes the project and generates arco.yaml
Analyzes and validates all generated artifacts
Manages database tables and columns
Manages the navigation menu in the database
Lists all generated artifacts
Generates Controller + View + registered route
Generates a PHP Model with basic CRUD methods
Generates a PHP view inside app/views/
Generates a full ArtiGrid CRUD page
Generates a dashboard with multiple grids
Generates a stats panel with metrics and charts
Generates login + logout + auth guard
Generates a reusable component
Generates a CSS grid layout
Generates a reusable master layout
Generates a complete interface with sections
Generates a page with a layout
Generates a web-based menu manager
Step-by-step interactive assistant
init
Initializes a new Artigrid project in the current directory. Generates the arco.yaml configuration file and the base folder structure.
Options
| Option | Description | Default |
|---|---|---|
--name | Project name | Current directory name |
--namespace | PHP namespace for the project | App\Artigrid |
--output-dir | Directory where generated artifacts are saved | artigrid |
--style | Style system: css, tailwind, or scss | css |
--engine | Template engine: html, blade, or twig | html |
-f, --force | Overwrite arco.yaml if it already exists without prompting | — |
Folders created
artigrid/components— Reusable componentsartigrid/grids— Grid layoutsartigrid/layouts— Master layoutsartigrid/pages— Generated pagesartigrid/interfaces— Full interfacesartigrid/styles— Generated base stylesheetsartigrid/assets— Static assets
Examples
# Interactive mode (asks questions)
php arco init
# Non-interactive mode
php arco init --name="My App" --namespace="App\\Artigrid" --style=tailwind
# Overwrite existing configuration
php arco init --force
build
Analyzes all generated artifacts in the project (interfaces, pages, layouts, grids, components) and produces a status report with file count and size per type. Optionally validates file integrity.
Options
| Option | Description |
|---|---|
--dry-run | Shows what would be analyzed without writing the manifest |
--validate | Verifies that all files are readable and intact |
artigrid/.build.json — a manifest containing the build date, version, project name, and per-type artifact statistics.
Examples
# Standard build (generates manifest)
php arco build
# Preview report only, without writing any files
php arco build --dry-run
# Build with file integrity validation
php arco build --validate
db Database
Manages database tables and columns directly from the console. Create, drop, and modify tables without needing a SQL client.
Available actions
| Action | Description |
|---|---|
tables | Lists all tables with their column count and row count |
show <table> | Shows the full structure of a table (DESCRIBE) |
create <table> | Creates a new table with columns defined via options or interactively |
drop <table> | Drops a table (asks for confirmation) |
add-column <table> | Adds a column to an existing table |
drop-column <table> | Removes a column from an existing table |
Options for create
| Option | Description | Example |
|---|---|---|
-c, --columns | Columns in name:type:options format, comma-separated | name:varchar(100):not_null,age:int |
--timestamps | Automatically adds created_at and updated_at columns | — |
--soft-delete | Adds a deleted_at column for soft deletes | — |
-f, --force | Executes without asking for confirmation | — |
Options for add-column
| Option | Description | Default |
|---|---|---|
--column | Name of the new column | Asked interactively |
--type | SQL type: varchar(N), int, text, decimal(10,2), etc. | varchar(255) |
--nullable | Column allows NULL values | NOT NULL |
--default | Default value for the column | — |
--after | Insert column after another one (--after=name) | End of table |
--unique | Adds a UNIQUE index to the column | — |
Examples
# List all tables
php arco db tables
# Show table structure
php arco db show users
# Create a table with all columns in one command
php arco db create employees \
--columns="name:varchar(100):not_null,email:varchar(200):unique,role:varchar(50)" \
--timestamps
# Create a table interactively (step by step)
php arco db create products
# Add a column
php arco db add-column users --column=phone --type=varchar(20) --nullable
php arco db add-column users --column=status --type=tinyint --default=1 --after=email
# Drop a column
php arco db drop-column users --column=phone
# Drop a table without confirmation
php arco db drop users --force
int, bigint, tinyint, varchar(N), text, longtext, decimal(10,2), float, double, date, datetime, timestamp, boolean, json, char(N)
list:templates
Lists all artifacts generated by Arco in the current project, showing filename, size, and last modified date, organized by category.
Options
| Option | Description |
|---|---|
-t, --type | Filter by category: interfaces, grids, layouts, pages, or components. Shows all if omitted. |
Examples
# List all artifacts
php arco list:templates
# Components only
php arco list:templates --type=components
# Generated pages only
php arco list:templates --type=pages
make:controller Generates files
Generates a PHP Controller, its corresponding View, registers the route in router.php, and adds the item to the sidebar menu. Optionally generates a Model as well.
Arguments and options
| Parameter | Description | Default |
|---|---|---|
Name | Controller name in PascalCase (e.g. Employees) | Required |
-u, --url | URL segment for the route (e.g. employees) | kebab-case of name |
-t, --title | Title shown in the topbar | Same as name |
-i, --icon | FontAwesome icon for the menu | fa-table |
--with-grid | Includes an ArtiGrid grid in the view and controller | No |
--table | Database table name for the grid (--with-grid) | snake_case of name |
--with-model | Also generates the NameModel.php file | No |
--no-nav | Does not register the item in the sidebar menu | Registers by default |
-o, --overwrite | Overwrites existing files | No |
Generated files
app/controllers/NameController.php— With index, create, store, show, edit, update, and destroy methodsapp/views/name/index.php— Basic view (or with ArtiGrid grid if--with-grid)app/models/NameModel.php— Only if--with-modelis used- Route registered in
app/core/router.php - Item added to
nav_itemsin the database (ornav.jsonas fallback)
Examples
# Basic controller
php arco make:controller Employees --icon=fa-users
# With an ArtiGrid grid connected to a table
php arco make:controller Products --with-grid --table=products --icon=fa-box
# With grid and model
php arco make:controller Clients --with-grid --table=clients --with-model --icon=fa-building
# Without registering in the sidebar menu
php arco make:controller Reports --no-nav
make:model Generates files
Generates a standalone PHP Model with complete CRUD methods: all(), find(), where(), create(), update(), delete(), count(), and paginate().
Options
| Parameter | Description | Default |
|---|---|---|
Name | Model name in PascalCase (e.g. Employee, Product) | Required |
-t, --table | Database table name | snake_case of name + 's' |
-o, --overwrite | Overwrite if already exists | No |
Included methods
all(string $orderBy, string $dir)— Fetches all records with configurable orderingfind(int $id)— Finds a record by IDwhere(string $field, mixed $value)— Filters records by a field valuecreate(array $data)— Inserts a record, returns the new IDupdate(int $id, array $data)— Updates a recorddelete(int $id)— Deletes a recordcount()— Returns the total number of recordspaginate(int $page, int $perPage)— Returns a page with full pagination metadata
Examples
# Model with automatically inferred table name (employees)
php arco make:model Employee
# Model with an explicit table name
php arco make:model Product --table=products
make:view Generates files
Generates a PHP view inside app/views/. Supports three variants: basic, with an ArtiGrid grid placeholder, or with an HTML table.
Options
| Parameter | Description | Default |
|---|---|---|
path/view | Path relative to app/views/ (e.g. employees/detail) | Required |
-t, --title | Heading title for the view | Filename |
--with-grid | Includes <?= $grid ?? '' ?> to render an ArtiGrid grid | No |
--with-table | Includes a basic Bootstrap HTML table with dynamic rows | No |
-o, --overwrite | Overwrite if already exists | No |
Examples
# Basic view
php arco make:view employees/detail --title="Employee Detail"
# View with an ArtiGrid grid placeholder
php arco make:view reports/sales --with-grid
# View with a dynamic HTML table
php arco make:view dashboard/index --with-table
make:crud Generates files
Generates a complete PHP page with an ArtiGrid CRUD interface for a database table. The most feature-rich command: supports column selection, renaming, field types, comboboxes, validation, WHERE filters, JOINs, nested tables, exports, and more.
Main options
| Option | Description | Default |
|---|---|---|
Name | Descriptive name (e.g. Users, ProductList) | Required |
table | Database table (e.g. users). Asked if omitted. | snake_case of name |
-m, --mode | Mode: editable (full CRUD), readonly (read-only), query | editable |
-c, --columns | Columns visible in the grid, comma-separated | All columns |
-r, --rename | Rename columns: --rename=field=Label (repeatable) | — |
--field-type | Input type override: --field-type=status=select (repeatable) | Inferred |
--combobox | Relational dropdown: --combobox=field=table:value:label | — |
--required | Required fields, comma-separated | None |
-w, --where | WHERE filter: --where=status==active (repeatable) | — |
-o, --order-by | Sort column | — |
--order-dir | Sort direction: asc or desc | asc |
-p, --per-page | Records per page | 10 |
-e, --export | Export formats: excel, csv, pdf (comma-separated) | — |
--modal | Use modals for forms | No |
--render | Render mode: crud, onepage, or insert | crud |
--nested | Nested table: --nested="Label=parent_key:child_table:child_key" | — |
--join | JOIN: --join=local_col=table:foreign_col:LEFT | — |
--no-add / --no-edit / --no-delete / --no-view / --no-search | Disable specific actions | All enabled |
--no-nav | Do not register in the sidebar menu | Registers |
--icon | FontAwesome icon for the menu | fa-table |
--overwrite | Overwrite existing files | No |
Examples
# Basic CRUD
php arco make:crud Users users
# With selected columns and modal forms
php arco make:crud Products products --columns=id,name,price,stock --modal
# With renaming, combobox, and export
php arco make:crud Employees employees \
--columns=id,name,email,department_id,status,hire_date \
--rename=name=Name \
--rename=department_id=Department \
--rename=hire_date="Hire Date" \
--field-type=status=select \
--field-type=hire_date=date \
--combobox=department_id=departments:id:name \
--required=name,email \
--export=excel,csv \
--modal
# With WHERE filter and sorting
php arco make:crud Orders orders \
--where=status==pending \
--order-by=created_at \
--order-dir=desc \
--per-page=20
# With nested child table
php arco make:crud Clients clients \
--nested="Orders=id:orders:client_id"
# With JOIN
php arco make:crud Users users \
--join=role_id=roles:id:LEFT \
--columns=name,email,roles_name
# Read-only with export
php arco make:crud Reports orders --mode=readonly --export=excel,pdf
make:dashboard Generates files
Generates a PHP dashboard with a sidebar, multiple ArtiGrid grids, and optional authentication support. Define several tables that will be displayed as independent sections.
Options
| Option | Description | Default |
|---|---|---|
Name | Dashboard name in PascalCase (e.g. AdminPanel) | Required |
-g, --grids | Comma-separated grids in table:Title format | Asked interactively |
--with-auth | Includes require_once auth.php to protect the dashboard | No |
-o, --overwrite | Overwrite if already exists | No |
Examples
# Dashboard with two grids
php arco make:dashboard AdminPanel --grids=users:Users,orders:Orders
# Dashboard with auth guard
php arco make:dashboard Panel --grids=employees:Employees --with-auth
# Interactive mode (asks grid by grid)
php arco make:dashboard MyPanel
--with-auth is used, remember to generate the login with php arco make:login.
make:stats Generates files
Generates a complete stats panel with: metric cards (table row counts), a monthly activity chart using ArtiGrid + Chart.js, and a recent records table. Automatically registers the Controller, View, and route.
Options
| Option | Description | Default |
|---|---|---|
-m, --metrics | Tables for count cards: table:Label:icon (comma-separated) | — |
--chart-table | Table for the monthly activity chart | First metric |
--chart-date | Date column to group chart data by | created_at |
--chart-type | Chart type: bar, line, or doughnut | bar |
--recent-table | Table for the recent records section | First metric |
--recent-cols | Columns to display in the recent records table | id, created_at |
--recent-limit | Number of recent records to show | 8 |
-u, --url | URL segment for the route | kebab-case of name |
-t, --title | Panel title | Name |
--no-nav | Do not register in the sidebar menu | Added at top of menu |
Examples
# Full stats panel
php arco make:stats Dashboard \
--metrics=users:Users:fa-users,orders:Orders:fa-cart-shopping,products:Products:fa-box \
--chart-table=orders --chart-date=created_at --chart-type=line \
--recent-table=users --recent-cols=name,email,created_at
# Minimal panel with a single metric
php arco make:stats Summary --metrics=admin_users:Admins:fa-user-shield
make:login Generates files
Generates a complete authentication system with three files: a login page, a logout handler, and an auth guard.
Options
| Option | Description | Default |
|---|---|---|
-t, --table | Users table in the database | users |
-u, --user | Column containing the username or email | email |
-p, --password | Column containing the hashed password | password |
-r, --role | Role column for access control | role |
--name | Column with the user's display name (stored in session) | name |
--redirect | URL to redirect to after a successful login | dashboard.php |
--roles | Allowed roles, comma-separated | All roles |
Generated files
pages/login.php— ArtiGrid login formpages/logout.php— Destroys the session and redirectspages/auth.php— Guard: include at the top of protected pages
Examples
# Basic login with defaults
php arco make:login
# Custom login
php arco make:login --table=users --user=email --password=password --redirect=dashboard.php
# Login with role-based access control
php arco make:login --roles=admin,editor
# Protecting a page with the generated guard:
# Add this line at the top of the PHP file:
require_once 'auth.php';
make:component Generates files
Generates a reusable Artigrid component. Supports multiple base types, props, slots, style variants, and optionally a PHP component class.
Available component types
card, nav, modal, table, form, button, badge, alert, dropdown, tabs, hero, sidebar, header, footer, widget
Options
| Option | Description | Default |
|---|---|---|
-t, --type | Base component type (defines suggested props) | card |
-p, --props | Component props, comma-separated | Asked interactively |
--slots | Component slots, comma-separated | — |
-v, --variants | Style variants, comma-separated | default |
--php-class | Also generates a PHP class for the component | No |
-o, --overwrite | Overwrite if already exists | No |
Examples
# User card component
php arco make:component UserCard --type=card --props=name,avatar,role,email
# Navigation bar with slots and variants
php arco make:component NavBar --type=nav --slots=brand,links,actions --variants=light,dark
# Data table with PHP class
php arco make:component DataTable --type=table --props=columns,rows,sortable --php-class
make:grid Generates files
Generates a reusable CSS grid layout. Supports simple grids, named grid-areas, and responsive breakpoint variants.
Options
| Option | Description | Default |
|---|---|---|
-c, --columns | Number of grid columns | Value from arco.yaml |
-r, --rows | Number of rows (0 = auto height) | 0 |
-a, --areas | grid-template-areas definition | — |
-g, --gap | Gap between grid cells | 1rem |
--responsive | Generates responsive variants for each breakpoint (sm, md, lg, xl) | No |
Examples
# Responsive 2-column grid
php arco make:grid TwoColumn --columns=2 --gap=2rem --responsive
# Dashboard with named areas
php arco make:grid Dashboard --areas="header header / sidebar main / footer footer"
# Masonry-style grid
php arco make:grid Masonry --columns=3 --rows=0
make:layout Generates files
Generates a reusable master layout with predefined content regions. Includes presets for the most common application types.
Type presets and their default regions
| Type | Default regions |
|---|---|
app | header, main, footer |
dashboard | topbar, sidebar, main, footer |
marketing | header, main, footer |
auth | main |
minimal | main |
Examples
php arco make:layout App --type=app --regions=header,main,aside,footer
php arco make:layout Marketing --type=marketing
php arco make:layout Auth --type=auth
make:interface Generates files
Generates a complete large interface with grids, sections, and components. Unlike make:layout, it generates the full visual structure with content sections already in place.
Default sections by type
| Type | Default sections |
|---|---|
dashboard | header, sidebar, main, widgets, footer |
admin | topbar, sidebar, breadcrumb, content, footer |
landing | hero, features, pricing, cta, footer |
portal | header, nav, hero, cards, footer |
app | header, main, aside, footer |
Examples
php arco make:interface Dashboard --type=dashboard --with-nav --with-sidebar
php arco make:interface AdminPanel --type=admin --sections=header,sidebar,main,footer
php arco make:interface LandingPage --type=landing --columns=12
make:page Generates files
Generates a complete Artigrid page tied to an existing layout, with URL route support and SEO meta tags.
Options
| Option | Description | Default |
|---|---|---|
-l, --layout | Layout name to use, or a relative path | default |
--title | HTML page title | Page name |
--route | URL route (e.g. /users/{id}) | /kebab-case-of-name |
--with-meta | Includes full SEO meta tags (og:, twitter:, etc.) | No |
Examples
php arco make:page Home --layout=marketing --title="Welcome" --with-meta
php arco make:page UserProfile --layout=app --route="/users/{id}"
make:wizard Interactive Database
A step-by-step interactive assistant for creating a complete CRUD manager. Guides the user through numbered questions, can create the database table if it does not exist, and generates all MVC files in a single session.
Wizard steps
| Step | Question |
|---|---|
| ① | Manager name (e.g. Employees, Products) |
| ② | Database table name |
| ③ | Create the table if it does not exist? (define columns interactively) |
| ④ | Title shown in the topbar |
| ⑤ | FontAwesome icon |
| ⑥ | Use modal forms? |
| ⑦ | Columns to show in the grid |
| ⑧ | Enable export? (excel, csv, pdf) |
| ⑨ | Sort column |
| ⑩ | Records per page |
| ⑪ | Disable any actions? (add, edit, delete, view, search) |
| ⑫ | Add a nested child table? |
| ⑬ | Add to the sidebar menu? |
| ⑭ | Also generate a PHP Model? |
Generated files
app/controllers/NameController.phpapp/views/name/index.phpapp/models/NameModel.php— Only if selected in step ⑭database/migrations/YYYY_MM_DD_HHmmss_create_table_name_table.sql— Only if a new table was created- Route registered in
app/core/router.php - Item added to the menu in the database or
nav.json
Available column types when creating a table
string (VARCHAR 255), text, integer, bigint, decimal (10,2), boolean, date, datetime, time, json, float
Usage
php arco make:wizard
Introduction Visual Builder
ArtiGrid Builder Pro is a visual code generator that creates PHP code for ArtiGrid CRUD interfaces without manual coding. It provides an intuitive drag-and-drop interface where you configure database tables, fields, validation rules, and rendering modes—then instantly generates production-ready PHP code.
What Problems Does It Solve?
- Eliminates repetitive PHP boilerplate code for CRUD operations
- Allows non-developers to create database interfaces visually
- Enables rapid prototyping and iteration of forms and grids
- Supports multiple render modes (table, form, calendar, login, chart)
- Generates production-ready code with proper validation and security practices
- Integrates seamlessly with your existing ArtiGrid configuration
How ArtiGrid Builder Works
ArtiGrid Builder follows a simple workflow:
1. Select your database table from the dropdown
2. Choose a render mode (CRUD, Form, Calendar, Login, or Chart)
3. Configure mode-specific settings (columns, fields, validation)
4. Review the generated PHP code in real-time
5. Copy the code and paste it into your project
Interface Components
The Builder interface is divided into three main areas:
| Component | Purpose | Location |
|---|---|---|
| Form Section | Visual configuration panel for selected render mode | Left side (70% width) |
| Preview Section | Live preview of how the grid/form will appear | Right side (30% width) |
| Code Output | Generated PHP code ready to copy | Below preview or separate tab |
Five Render Modes
ArtiGrid Builder supports five different rendering modes, each designed for specific use cases:
CRUD
Full data grid with create, read, update, delete operations
Form
Standalone insert/edit form without the grid view
Calendar
Event calendar view with drag-drop and color coding
Login
Authentication form with custom styling options
Chart
Data visualization with multiple chart types
CRUD Mode
CRUD (Create, Read, Update, Delete) mode generates a complete data management interface with a sortable, filterable data grid and built-in forms for editing records.
Features Available
- Table selection from database
- Column visibility toggling
- Form field arrangement and grouping
- Required field validation
- Action button configuration (view, edit, delete)
- Button arrangement (dropdown or inline)
- Search and filter panel
- Pagination and per-page settings
- Inline editing (optional)
- Modal vs. inline form rendering
- Column rename and field type customization
- Combobox (dropdown) configuration
- Custom button creation
- Export functionality (Excel, CSV, PDF)
Configuration Steps
- Select Table: Choose your database table from the dropdown
- Choose Columns: Select which columns appear in the grid
- Define Form Fields: Pick fields that appear in insert/edit forms
- Set Validation: Mark fields as required or add custom validation
- Configure Actions: Choose which actions (view, edit, delete) are enabled
- Review Code: Copy the generated PHP code
Generated Code Example
$grid = new ArtiGrid();
$grid->table('employees')
->template('bootstrap5')
->perPage(10)
->required(false)
->validation_required(['firstName','lastName'])
->crudCol(['employeeNumber','firstName','lastName','email'])
->formFields(['employeeNumber','firstName','lastName','email','officeCode'])
->modal();
echo $grid->render();
Form Mode (Insert Only)
Form mode generates a standalone insert form without displaying the data grid. This is ideal for dedicated data entry pages or when you want to focus the user's attention on completing a form.
Use Cases
- Multi-step registration or onboarding processes
- Dedicated survey or feedback forms
- Order entry pages
- Invoice or invoice line item creation
- Custom workflows where grid view is not needed
Configuration Options
| Option | Description | Default |
|---|---|---|
| Form Fields | Which columns appear as form inputs | All columns |
| Required Fields | Fields that must be filled before submission | None |
| Field Grouping | Organize fields into logical sections | No grouping |
| Redirect on Success | URL to navigate to after form submission | Reload page |
| Custom Button Text | Label for the submit button | "Submit" |
Generated Code Example
$grid = new ArtiGrid();
$grid->table('orders')
->template('bootstrap5')
->required(false)
->validation_required(['customerNumber','orderDate','status'])
->formFields(['customerNumber','orderDate','status','comments'])
->modal();
echo $grid->render('insert');
Calendar Mode
Calendar mode generates an interactive calendar interface for tables with date fields, like events, appointments, or tasks. It supports drag-and-drop, color coding, and custom color pickers.
Essential Configuration
| Field | Description | Required |
|---|---|---|
Title Field | Column displayed as event title | Yes |
Start Field | Column containing the event start date | Yes |
End Field | Column containing the event end date | No |
Color Field | Column for event color codes | No |
All Day Field | Boolean column for all-day events | No |
Color Picker Configuration
Enable the optional color picker for users to assign colors to events:
- Color Palette: Define available colors (space-separated hex codes)
- Picker Position: Choose between "fixed" (for modals) or default positioning
- Default Colors: Pre-defined palette: #3788d8, #28a745, #dc3545, #fd7e14
Generated Code Example
$grid = new ArtiGrid();
$grid->table('appointments')
->template('bootstrap5')
->calendarTitle('title')
->calendarStart('start_date')
->calendarEnd('end_date')
->calendarColor('color')
->calendarAllDay('all_day')
->calendarView('dayGridMonth')
->calendarLocale('en')
->colorPicker('color', ['#3788d8','#28a745','#dc3545'], 'fixed');
echo $grid->render('calendar');
Login Mode
Login mode generates a user authentication form that validates credentials against a database table. It supports custom HTML styling and optional server-side validation callbacks.
Configuration Options
- Username Field: Column containing usernames or email addresses
- Password Field: Column with hashed passwords
- Form Template: Custom HTML layout for the login form
- Validation Callback: Server-side login logic (optional)
- Success Redirect: URL to navigate to after successful login
Optional Features
| Feature | Description |
|---|---|
| Custom Template | HTML form layout with placeholders {user}, {password}, {action} |
| Validation Callback | Server-side PHP function to verify credentials |
| Session Management | Automatic session creation on successful login |
| RBAC Support | Role-based access control via callbacks |
Generated Code Example
$grid = new ArtiGrid();
$grid->table('users')
->template('bootstrap5')
->required(false)
->validation_required(['username','password'])
->formFields(['username','password']);
echo $grid->render('select');
Chart Mode
Chart mode generates data visualizations from your database. It supports multiple chart types and dynamic SQL-based datasets, allowing you to create real-time dashboards without extra charting libraries.
Supported Chart Types
- Bar Chart: Compare values across categories
- Line Chart: Show trends over time
- Pie Chart: Display proportions and percentages
- Doughnut Chart: Similar to pie with a centered hole
- Radar Chart: Compare multiple variables around a central axis
- Polar Area Chart: Show values as radial areas
Dataset Configuration
Each chart can have multiple datasets. For each dataset you configure:
| Property | Description |
|---|---|
Label | Name appearing in the chart legend |
Data Source | Static array or SQL query (prefix with #) |
Background Color | Fill color with optional transparency |
Border Color | Line/border color for the dataset |
Border Width | Thickness of lines in pixels |
Dynamic SQL Datasets
You can load chart data directly from the database by prefixing the query with a hash (#):
# Example: Dynamic dataset
#select SUM(amount) from orders where orderDate >= DATE_SUB(NOW(), INTERVAL 30 DAY)
Generated Code Example
$grid = new ArtiGrid();
$grid->table('sales')
->template('bootstrap5');
$grid->chart_labels(
['Jan', 'Feb', 'Mar', 'Apr', 'May'],
[
[
'label' => 'Sales Volume',
'data' => '#select COUNT(*) from sales where MONTH(date) IN (1,2,3,4,5)',
'backgroundColor' => 'rgba(55, 136, 216, 0.2)',
'borderColor' => 'rgba(55, 136, 216, 1)',
'borderWidth' => 1
]
],
'bar'
);
$grid->chart_view(true);
echo $grid->render();
chart_labels() pattern for its monthly activity chart — the Builder just lets you assemble it visually first.
Code Generation & Export
After configuring your settings, ArtiGrid Builder generates production-ready PHP code that you can immediately use in your application.
The Generated Code Includes
- ArtiGrid class instantiation
- Table/database selection
- Column configuration (visible columns, form fields)
- Validation rules (required fields, custom validations)
- UI customization (template, button arrangement, modals)
- Mode-specific configuration (calendar fields, chart data, etc.)
- Render call with appropriate mode and parameters
Copying and Using Generated Code
- Click the "Copy Code" button in the preview area
- Paste into your PHP file that requires ArtiGrid.php
- Ensure your database credentials are configured in your db.php
- Test the generated interface in your browser
- Customize further using ArtiGrid methods if needed
Best Practices
1. Start Simple, Then Extend
Use the Builder to generate the basic CRUD grid, then enhance it with advanced features using direct ArtiGrid method calls in your code.
2. Validate Field Types
Ensure your database schema has appropriate column types (VARCHAR, DATE, INT, etc.) so the Builder can correctly infer validation rules and input types.
3. Plan Form Field Grouping
Before generating code, decide which fields belong together logically. Use the Builder's field arrangement feature to organize them into sections.
4. Use Modal Forms for CRUD
For standard CRUD operations, enable modal forms to keep users focused on the grid without page navigation.
5. Test Generated Code Immediately
Copy the generated code and test it right away to ensure it works in your environment before making further modifications.
6. Keep Builder Configuration Stable
Avoid frequently switching tables in the Builder. Generate code for one table at a time, and organize your generated scripts logically in your project.
7. Combine with ArtiGrid Methods
The Builder generates basic code. Enhance it with ArtiGrid's advanced features:
- combobox() for relational dropdowns
- fieldCondition() for dynamic field visibility
- setActionCondition() for conditional button display
- callbacks() for custom validation logic
- nestedTable() for multi-level hierarchies
Security Considerations
Protecting the Builder
Always follow these security practices when deploying ArtiGrid Builder:
- Restrict Access: Place the Builder behind user authentication. Only developers should access it.
- Development Environment Only: Use the Builder only in development or staging environments, never in production.
- Database Credentials: Ensure your db.php file uses secure, limited credentials—not the production admin account.
- Rename the Builder: Consider renaming builder.php to something non-obvious, or use a URL rewrite to limit access.
- Disable in Production: Remove or disable the Builder entirely from production deployments.
- Access Logs: Monitor access logs for unauthorized Builder usage attempts.
Generated Code Security
The generated code itself follows best practices:
- Uses prepared statements (ArtiGrid handles parameterized queries internally)
- Implements CSRF protection through ArtiGrid's session handling
- Supports role-based access control via callbacks and permissions
- Validates input using configurable required-field rules
- Does not expose sensitive database structures to end users
Additional Recommendations
- Always validate and sanitize user input server-side using callbacks
- Implement proper session management and timeout policies
- Use HTTPS to encrypt data in transit
- Regularly update ArtiGrid to the latest secure version
- Test generated forms for XSS vulnerabilities before deployment
- Implement rate limiting on sensitive operations (delete, bulk edit)