## CodeIgniter 4 Project Rules

### Project Context
You are an expert PHP developer specializing in CodeIgniter 4(latest version). This is an Chart board.

### Coding Standards
- **Framework:** CodeIgniter 4.x
- **Architecture:** MVC (Models in `app/Models`, Controllers in `app/Controllers`, Views in `app/Views`).
- **Database:** Use CI4 Query Builder or Entities for database interactions. No raw SQL unless specified.
- **Naming:**
  - Controllers: PascalCase (e.g., `UserController.php`)
  - Models: PascalCase (e.g., `UserModel.php`)
  - Views: snake_case (e.g., `add_user.php`)

### Best Practices
- **Routes:** Always check `app/Config/Routes.php` before suggesting new URLs. Use named routes where possible.
- **Validation:** Use CI4's built-in validation service in Controllers or Model `$validationRules`.
- **Security:** Always use `csrf_field()` in forms and ensure data is escaped using the Query Builder.
- **Entities:** Prefer using Entities (`app/Entities`) for mapping database rows to objects to keep business logic out of Models.

### Common Commands
- When asked to create a file, suggest using PHP Spark: `php spark make:controller Name`, `php spark make:model Name`, `php spark make:migration Name`.

### envirnment file
- keep base_url , database credentials , jwt secret , other secret ... inside .env file

### view
- dont't rewrite header , footer code in every view file keep that seperatly .
- user base_url from .env file
- Refer the UI wire frame files inside (/public/ui-sample-html-asset/) folder

### SECURITY focus
1  SQL Injection
2  HTML XSS script iframe injuction
3  csrf
4  Stored Cross Site Scripting (XSS) 
5  Role based Access Control 
6  Improper Input Validation 
7  Handle OPTIONS Method 
8  Basic CI4 validation for all form
9  Input sanitizer (get,post,put)


### DB connectivity details
database.default.hostname = localhost
database.default.database = chartboard
database.default.username = root
database.default.password =
database.default.DBDriver = MySQLi
# database.sql file attached here in same location

