artiframe make:view
The artiframe make:view command adds a new HTML page (View) to your project.
It doesn't just create a single .php file; it automatically generates its specific CSS and JS files and places them into the correct directories.
Usage
$ artiframe make:view [path/filename]
Examples
# Root level page under public/
$ artiframe make:view dashboard
# Page within a subdirectory
$ artiframe make:view panel/reports
# The .php extension is optional — it appends it automatically
$ artiframe make:view panel/reports.php
Generated Files
For instance, when you run artiframe make:view panel/reports, the following 3 files are created:
| File | Path |
|---|---|
| View (PHP) | public/panel/reports.php |
| CSS | public/assets/css/panel/reports.css |
| JS | public/assets/js/panel/reports.js |
View Stub Content
The generated .php file comes with this structure, perfectly aligned with the ArtiFrame architecture:
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/../app/ViewControl.php';
use Bin\ViewMethod;
?>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/head.php'; ?>
Reports
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/mobilenav.php'; ?>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
Important points to note:
- The
data-themeanddata-modeattributes work with ArtiFrame's theme system (CSS Variables). - CSS and JS files are loaded with the
?v=APP_VERSIONcache-busting parameter. head.php,header.php,mobilenav.php, andfooter.phpare shared layout components.
JS Stub Content
The automatically generated .js file includes a ready-to-use template for CSRF tokens and Fetch API usage:
/* JS for Reports */
// CSRF Token (Mandatory for API requests)
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
/*
* Fetch API Usage Example:
*
* fetch('/api/standard/endpoint', {
* method: 'POST',
* headers: {
* 'Content-Type': 'application/json',
* 'X-CSRF-TOKEN': csrfToken
* },
* body: JSON.stringify({ key: 'value' })
* });
*/
auth/ Special Behavior
If the target path starts with auth/ (e.g., artiframe make:view auth/login), the system uses a specialized auth-view.stub template instead of the standard view.stub.
This stub provides a minimal layout tailored for authentication pages (e.g., centered card forms, session checks).