# vmakar2160/osticket architecture

> Architecture diagram of the GitHub repository vmakar2160/osticket, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vmakar2160/osticket
- Repository: https://github.com/vmakar2160/osticket

## Overview

#### Purpose and runtime
osTicket is a server-rendered PHP support-ticket system: web, email, and phone-originated requests become tickets for staff handling. It targets Apache or IIS, PHP 7.2–7.4, and MySQL via mysqli; IMAP, SMTP/sendmail, GD, gettext, JSON, mbstring, and XML extend core capabilities. Bootstrap and shared initialization begin at `bootstrap.php`, `main.inc.php`, and `include/class.osticket.php`.

#### HTTP entry surfaces
The public client portal is rooted in `index.php`, with ticket creation and viewing through `open.php`, `tickets.php`, and `view.php`; reusable client rendering lives under `include/client/`. The staff control panel is independently routed through `scp/index.php`, `scp/tickets.php`, and `scp/staff.inc.php`, rendering views from `include/staff/`. AJAX is a separate controller boundary at `ajax.php` and `scp/ajax.php`, backed by feature-specific handlers such as `include/ajax.tickets.php`.

#### Domain and persistence core
Ticket handling centers on `include/class.ticket.php`, `include/class.thread.php`, and `include/class.message.php`: tickets contain conversation threads/messages, notes, assignments, status, SLA, and task relationships. Users, staff, departments, teams, organizations, roles, and authentication are modeled in `include/class.user.php`, `include/class.staff.php`, and `include/class.dept.php`. Database access and object persistence use the internal model/ORM layer in `include/class.model.php`, `include/class.orm.php`, and `include/mysqli.php`; MySQL schema installation starts at `setup/inc/streams/core/install-mysql.sql`.

#### Intake, routing, and notifications
Web forms feed dynamic-form validation and ticket creation through `include/class.dynamic_forms.php`, `include/class.forms.php`, and `include/class.ticket.php`. Email ingestion is handled by parsing/fetching components (`include/class.mailfetch.php`, `include/class.mailparse.php`) and API/pipe endpoints (`api/pipe.php`, `api/http.php`). Filters, help topics, queues, departments, and SLAs determine routing and priority via `include/class.filter.php`, `include/class.topic.php`, and `include/class.sla.php`. Ticket events generate outbound notifications through `include/class.mailer.php` and `include/class.email.php`, using localized templates in `include/i18n/en_US/templates/email/`.

#### APIs, jobs, and automation
The external HTTP API is exposed under `api/index.php`, authenticated/processed through `api/api.inc.php` and `include/class.api.php`; ticket-specific operations are in `include/api.tickets.php`. Scheduled processing is entered by `api/cron.php` or staff-side `scp/autocron.php`, with execution logic in `include/class.cron.php` and `include/api.cron.php`. The CLI dispatcher `manage.php` exposes operational modules in `include/cli/modules/`, including deployment, upgrades, imports/exports, file migration, and cron execution.

#### Security and extensibility boundaries
Session and identity boundaries are implemented by `include/class.ostsession.php`, `include/class.usersession.php`, `include/class.auth.php`, with CSRF, 2FA, passwords, and cryptography in `include/class.csrf.php`, `include/class.2fa.php`, and `include/class.crypto.php`. File attachments are managed behind `include/class.attachment.php` and `include/class.file.php`. Plugins are loaded through `include/class.plugin.php` from `include/plugins/`, allowing extensions without coupling them directly into ticket workflows.

#### Lifecycle, upgrades, and localization
Initial installation is a dedicated setup application at `setup/index.php` and `setup/install.php`, driven by `setup/inc/class.installer.php`. Runtime upgrades are initiated from the staff panel (`scp/upgrade.php`) and executed through `include/class.upgrader.php`; versioned SQL/PHP migration streams reside in `include/upgrader/streams/core/`. Translation catalogs, system defaults, and email/page templates are YAML-based under `include/i18n/en_US/`, interpreted through `include/class.i18n.php` and `include/class.yaml.php`.

Main entry points: [`include/class.ticket.php`](https://github.com/vmakar2160/osticket/blob/develop/include/class.ticket.php) (Ticket domain), [`include/class.ostsession.php`](https://github.com/vmakar2160/osticket/blob/develop/include/class.ostsession.php) (Sessions & security), [`index.php`](https://github.com/vmakar2160/osticket/blob/develop/index.php) (Client portal), [`scp/index.php`](https://github.com/vmakar2160/osticket/blob/develop/scp/index.php) (Staff panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry Surfaces"]
  node_client["Client portal<br/>PHP web UI<br/>[index.php]"]
  node_staff["Staff panel<br/>PHP web UI<br/>[index.php]"]
  node_ajax["AJAX controllers<br/>HTTP controller<br/>[ajax.php]"]
  node_api["External API<br/>HTTP API<br/>[index.php]"]
end

subgraph group_core["Ticket Core"]
  node_ticket["Ticket domain<br/>domain model<br/>[class.ticket.php]"]
  node_conversation["Threads &amp; messages<br/>conversation model<br/>[class.thread.php]"]
  node_identity["Users &amp; organization<br/>identity model<br/>[class.user.php]"]
  node_auth{{"Sessions &amp; security<br/>auth boundary"}}
  node_routing["Routing policy<br/>filters and SLA<br/>[class.filter.php]"]
  node_forms["Dynamic forms<br/>validation"]
  node_persistence["Model / ORM<br/>persistence layer<br/>[class.model.php]"]
  node_mysql[("MySQL<br/>database<br/>[install-mysql.sql]")]
end

subgraph group_automation["Intake &amp; Automation"]
  node_email_intake["Email intake<br/>mail parser"]
  node_mail_endpoints["Mail API &amp; pipe<br/>ingress endpoint<br/>[pipe.php]"]
  node_notifications["Email notifications<br/>mailer<br/>[class.mailer.php]"]
  node_templates["Localized templates<br/>YAML catalogs"]
  node_cron["Scheduled jobs<br/>job runner<br/>[class.cron.php]"]
  node_plugins{{"Plugin extensions<br/>extension loader<br/>[class.plugin.php]"}}
end

subgraph group_lifecycle["Lifecycle"]
  node_setup["Installer<br/>setup application<br/>[index.php]"]
  node_upgrades["Upgrade engine<br/>migration runner<br/>[class.upgrader.php]"]
  node_cli["Management CLI<br/>operations CLI<br/>[manage.php]"]
end

node_client -->|"client session"| node_auth
node_client -->|"submits requests"| node_forms
node_client -->|"creates and views"| node_ticket
node_staff -->|"staff session"| node_auth
node_staff -->|"handles tickets"| node_ticket
node_staff -->|"initiates"| node_upgrades
node_ajax -->|"ticket actions"| node_ticket
node_api -->|"authenticates"| node_auth
node_api -->|"ticket operations"| node_ticket
node_forms -->|"validated creation"| node_ticket
node_mail_endpoints -->|"receives mail"| node_email_intake
node_email_intake -->|"creates or replies"| node_ticket
node_ticket -->|"contains"| node_conversation
node_ticket -->|"applies routing"| node_routing
node_ticket -->|"emits events"| node_notifications
node_notifications -->|"renders"| node_templates
node_ticket -->|"persists"| node_persistence
node_identity -->|"persists"| node_persistence
node_auth -->|"resolves identity"| node_identity
node_persistence -->|"mysqli access"| node_mysql
node_cron -->|"scheduled processing"| node_ticket
node_plugins -.->|"extends"| node_ticket
node_setup -->|"installs schema"| node_mysql
node_upgrades -->|"runs migrations"| node_mysql
node_cli -->|"runs"| node_cron
node_cli -->|"operates"| node_upgrades

click node_client "https://github.com/vmakar2160/osticket/blob/develop/index.php"
click node_staff "https://github.com/vmakar2160/osticket/blob/develop/scp/index.php"
click node_ajax "https://github.com/vmakar2160/osticket/blob/develop/ajax.php"
click node_api "https://github.com/vmakar2160/osticket/blob/develop/api/index.php"
click node_ticket "https://github.com/vmakar2160/osticket/blob/develop/include/class.ticket.php"
click node_conversation "https://github.com/vmakar2160/osticket/blob/develop/include/class.thread.php"
click node_identity "https://github.com/vmakar2160/osticket/blob/develop/include/class.user.php"
click node_auth "https://github.com/vmakar2160/osticket/blob/develop/include/class.ostsession.php"
click node_routing "https://github.com/vmakar2160/osticket/blob/develop/include/class.filter.php"
click node_forms "https://github.com/vmakar2160/osticket/blob/develop/include/class.dynamic_forms.php"
click node_persistence "https://github.com/vmakar2160/osticket/blob/develop/include/class.model.php"
click node_mysql "https://github.com/vmakar2160/osticket/blob/develop/setup/inc/streams/core/install-mysql.sql"
click node_email_intake "https://github.com/vmakar2160/osticket/blob/develop/include/class.mailfetch.php"
click node_mail_endpoints "https://github.com/vmakar2160/osticket/blob/develop/api/pipe.php"
click node_notifications "https://github.com/vmakar2160/osticket/blob/develop/include/class.mailer.php"
click node_cron "https://github.com/vmakar2160/osticket/blob/develop/include/class.cron.php"
click node_plugins "https://github.com/vmakar2160/osticket/blob/develop/include/class.plugin.php"
click node_setup "https://github.com/vmakar2160/osticket/blob/develop/setup/index.php"
click node_upgrades "https://github.com/vmakar2160/osticket/blob/develop/include/class.upgrader.php"
click node_cli "https://github.com/vmakar2160/osticket/blob/develop/manage.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_staff,node_ajax,node_api toneBlue
class node_ticket,node_conversation,node_identity,node_auth,node_routing,node_forms,node_persistence,node_mysql toneAmber
class node_email_intake,node_mail_endpoints,node_notifications,node_templates,node_cron,node_plugins toneMint
class node_setup,node_upgrades,node_cli toneRose
```

## Components

### Entry Surfaces

- [Client portal](https://github.com/vmakar2160/osticket/blob/develop/index.php): PHP web UI · `index.php`
- [Staff panel](https://github.com/vmakar2160/osticket/blob/develop/scp/index.php): PHP web UI · `scp/index.php`
- [AJAX controllers](https://github.com/vmakar2160/osticket/blob/develop/ajax.php): HTTP controller · `ajax.php`
- [External API](https://github.com/vmakar2160/osticket/blob/develop/api/index.php): HTTP API · `api/index.php`

### Ticket Core

- [Ticket domain](https://github.com/vmakar2160/osticket/blob/develop/include/class.ticket.php): domain model · Tickets own threads, messages, assignments, status, SLAs, and tasks. · `include/class.ticket.php`
- [Threads & messages](https://github.com/vmakar2160/osticket/blob/develop/include/class.thread.php): conversation model · `include/class.thread.php`
- [Users & organization](https://github.com/vmakar2160/osticket/blob/develop/include/class.user.php): identity model · `include/class.user.php`
- [Sessions & security](https://github.com/vmakar2160/osticket/blob/develop/include/class.ostsession.php): auth boundary · `include/class.ostsession.php`
- [Routing policy](https://github.com/vmakar2160/osticket/blob/develop/include/class.filter.php): filters and SLA · `include/class.filter.php`
- [Dynamic forms](https://github.com/vmakar2160/osticket/blob/develop/include/class.dynamic_forms.php): validation · `include/class.dynamic_forms.php`
- [Model / ORM](https://github.com/vmakar2160/osticket/blob/develop/include/class.model.php): persistence layer · `include/class.model.php`
- [MySQL](https://github.com/vmakar2160/osticket/blob/develop/setup/inc/streams/core/install-mysql.sql): database · `setup/inc/streams/core/install-mysql.sql`

### Intake & Automation

- [Email intake](https://github.com/vmakar2160/osticket/blob/develop/include/class.mailfetch.php): mail parser · `include/class.mailfetch.php`
- [Mail API & pipe](https://github.com/vmakar2160/osticket/blob/develop/api/pipe.php): ingress endpoint · `api/pipe.php`
- [Email notifications](https://github.com/vmakar2160/osticket/blob/develop/include/class.mailer.php): mailer · `include/class.mailer.php`
- **Localized templates**: YAML catalogs
- [Scheduled jobs](https://github.com/vmakar2160/osticket/blob/develop/include/class.cron.php): job runner · `include/class.cron.php`
- [Plugin extensions](https://github.com/vmakar2160/osticket/blob/develop/include/class.plugin.php): extension loader · Extensions load without direct coupling to ticket workflows. · `include/class.plugin.php`

### Lifecycle

- [Installer](https://github.com/vmakar2160/osticket/blob/develop/setup/index.php): setup application · `setup/index.php`
- [Upgrade engine](https://github.com/vmakar2160/osticket/blob/develop/include/class.upgrader.php): migration runner · `include/class.upgrader.php`
- [Management CLI](https://github.com/vmakar2160/osticket/blob/develop/manage.php): operations CLI · `manage.php`

## Connections

- Client portal → Sessions & security: client session
- Client portal → Dynamic forms: submits requests
- Client portal → Ticket domain: creates and views
- Staff panel → Sessions & security: staff session
- Staff panel → Ticket domain: handles tickets
- Staff panel → Upgrade engine: initiates
- AJAX controllers → Ticket domain: ticket actions
- External API → Sessions & security: authenticates
- External API → Ticket domain: ticket operations
- Dynamic forms → Ticket domain: validated creation
- Mail API & pipe → Email intake: receives mail
- Email intake → Ticket domain: creates or replies
- Ticket domain → Threads & messages: contains
- Ticket domain → Routing policy: applies routing
- Ticket domain → Email notifications: emits events
- Email notifications → Localized templates: renders
- Ticket domain → Model / ORM: persists
- Users & organization → Model / ORM: persists
- Sessions & security → Users & organization: resolves identity
- Model / ORM → MySQL: mysqli access
- Scheduled jobs → Ticket domain: scheduled processing
- Plugin extensions → Ticket domain: extends
- Installer → MySQL: installs schema
- Upgrade engine → MySQL: runs migrations
- Management CLI → Scheduled jobs: runs
- Management CLI → Upgrade engine: operates
