API Documentation
Table of Contents
Namespaces
Functions
- auth() : User|null
- Get the authenticated user
- user() : User|null
- Alias for auth()
- user_id() : int|null
- Get the authenticated user's ID
- is_logged_in() : bool
- Check if user is authenticated
- is_guest() : bool
- Check if user is a guest (not authenticated)
- is_admin() : bool
- Check if user is an admin
- is_editor() : bool
- Check if user is an editor
- is_author() : bool
- Check if user is an author
- has_role() : bool
- Check if user has a specific role
- csrf_token() : string
- Get the current CSRF token
- csrf_field() : string
- Generate a CSRF token hidden input field
- current_user_identifier() : string
- Get current user identifier for audit purposes
- sendEmail() : bool
- Send a simple email
- sendEmailTemplate() : bool
- Send an email using a template
- email() : Sender
- Create a new email Sender instance with fluent interface
- gravatar_url() : string
- Generate a Gravatar URL for the given email address
- gravatar() : string
- Generate a complete Gravatar image tag
- route_path() : string
- Generate a relative URL path for a named route
- route_url() : string
- Generate an absolute URL for a named route
- format_user_datetime() : string
- Format a DateTimeImmutable object in the authenticated user's timezone
- format_user_date() : string
- Format a DateTimeImmutable object as a date (no time) in the authenticated user's timezone
- get_timezones() : array<string, array<string|int, string>>
- Get a list of all available timezones grouped by region
- group_timezones_for_select() : array<string, array<string|int, array{value: string, label: string, selected: bool}>>
- Prepare timezones for select dropdown with selection state
- boot() : Scheduler|null
- Initialize the application.
- scheduler() : void
- Run the application.
- dispatch() : string
- Dispatch a job to the queue for background processing
- dispatchNow() : mixed
- Execute a job immediately (synchronously), bypassing the queue
- getQueueManager() : QueueManager
- Get the queue manager instance from registry
- queueSize() : int
- Get the size of a queue
- clearQueue() : int
- Clear all jobs from a queue
Functions
auth()
Get the authenticated user
auth() : User|null
Return values
User|nulluser()
Alias for auth()
user() : User|null
Return values
User|nulluser_id()
Get the authenticated user's ID
user_id() : int|null
Return values
int|nullis_logged_in()
Check if user is authenticated
is_logged_in() : bool
Return values
boolis_guest()
Check if user is a guest (not authenticated)
is_guest() : bool
Return values
boolis_admin()
Check if user is an admin
is_admin() : bool
Return values
boolis_editor()
Check if user is an editor
is_editor() : bool
Return values
boolis_author()
Check if user is an author
is_author() : bool
Return values
boolhas_role()
Check if user has a specific role
has_role(string $role) : bool
Parameters
- $role : string
Return values
boolcsrf_token()
Get the current CSRF token
csrf_token() : string
Return values
stringcsrf_field()
Generate a CSRF token hidden input field
csrf_field() : string
Return values
stringcurrent_user_identifier()
Get current user identifier for audit purposes
current_user_identifier() : string
Returns the authenticated CMS user's username if available (web context), otherwise returns the OS user running the process (CLI context).
Return values
string —User identifier (e.g., "admin" or "www-data" or "system")
sendEmail()
Send a simple email
sendEmail(string $to, string $subject, string $body[, bool $isHtml = true ][, ISettingSource|null $settings = null ]) : bool
Parameters
- $to : string
-
Recipient email address
- $subject : string
-
Email subject
- $body : string
-
Email body content
- $isHtml : bool = true
-
Whether the body is HTML (default: true)
- $settings : ISettingSource|null = null
-
Optional settings source for email configuration
Tags
Return values
bool —True if email was sent successfully
sendEmailTemplate()
Send an email using a template
sendEmailTemplate(string $to, string $subject, string $template[, array<string|int, mixed> $data = [] ][, ISettingSource|null $settings = null ][, string $basePath = '' ]) : bool
Parameters
- $to : string
-
Recipient email address
- $subject : string
-
Email subject
- $template : string
-
Template path relative to resources/views
- $data : array<string|int, mixed> = []
-
Data to pass to the template
- $settings : ISettingSource|null = null
-
Optional settings source for email configuration
- $basePath : string = ''
-
Base path for template resolution (default: current directory)
Tags
Return values
bool —True if email was sent successfully
email()
Create a new email Sender instance with fluent interface
email([ISettingSource|null $settings = null ][, string $basePath = '' ]) : Sender
Parameters
- $settings : ISettingSource|null = null
-
Optional settings source for email configuration
- $basePath : string = ''
-
Base path for template resolution (default: current directory)
Tags
Return values
Sendergravatar_url()
Generate a Gravatar URL for the given email address
gravatar_url(string $email[, int $size = 80 ][, string $default = 'mp' ]) : string
Parameters
- $email : string
-
Email address
- $size : int = 80
-
Image size in pixels (default: 80)
- $default : string = 'mp'
-
Default image type (mp, identicon, monsterid, wavatar, retro, robohash, blank)
Tags
Return values
string —Gravatar URL
gravatar()
Generate a complete Gravatar image tag
gravatar(string $email[, int $size = 80 ][, string $default = 'mp' ][, string $class = '' ]) : string
Parameters
- $email : string
-
Email address
- $size : int = 80
-
Image size in pixels (default: 80)
- $default : string = 'mp'
-
Default image type (mp, identicon, monsterid, wavatar, retro, robohash, blank)
- $class : string = ''
-
Additional CSS classes to add to the img tag
Tags
Return values
string —Complete HTML img tag
route_path()
Generate a relative URL path for a named route
route_path(string $routeName[, array<string, mixed> $parameters = [] ]) : string
Parameters
- $routeName : string
-
The name of the route
- $parameters : array<string, mixed> = []
-
Route parameters
Tags
Return values
string —Relative URL path
route_url()
Generate an absolute URL for a named route
route_url(string $routeName[, array<string, mixed> $parameters = [] ]) : string
Parameters
- $routeName : string
-
The name of the route
- $parameters : array<string, mixed> = []
-
Route parameters
Tags
Return values
string —Absolute URL
format_user_datetime()
Format a DateTimeImmutable object in the authenticated user's timezone
format_user_datetime(DateTimeImmutable|null $dateTime[, string $format = 'Y-m-d H:i' ]) : string
Converts a DateTime from UTC to the user's preferred timezone and formats it. Falls back to system timezone if no user is authenticated or user has no timezone set.
Parameters
- $dateTime : DateTimeImmutable|null
-
DateTime to format (assumed to be in UTC)
- $format : string = 'Y-m-d H:i'
-
Date format string (default: 'Y-m-d H:i')
Tags
Return values
string —Formatted date/time string, or 'N/A' if dateTime is null
format_user_date()
Format a DateTimeImmutable object as a date (no time) in the authenticated user's timezone
format_user_date(DateTimeImmutable|null $dateTime[, string $format = 'Y-m-d' ]) : string
Convenience wrapper around format_user_datetime for date-only display.
Parameters
- $dateTime : DateTimeImmutable|null
-
DateTime to format (assumed to be in UTC)
- $format : string = 'Y-m-d'
-
Date format string (default: 'Y-m-d')
Tags
Return values
string —Formatted date string, or 'N/A' if dateTime is null
get_timezones()
Get a list of all available timezones grouped by region
get_timezones() : array<string, array<string|int, string>>
Returns an associative array with regions as keys and arrays of timezones as values. Useful for populating timezone dropdown selects.
Tags
Return values
array<string, array<string|int, string>> —Grouped timezones
group_timezones_for_select()
Prepare timezones for select dropdown with selection state
group_timezones_for_select(array<int, string> $timezones[, string|null $currentTimezone = null ]) : array<string, array<string|int, array{value: string, label: string, selected: bool}>>
Groups timezones by region and returns a structured array ready for rendering in a select dropdown. Each timezone includes value, label, and selected state.
Parameters
- $timezones : array<int, string>
-
List of timezone identifiers
- $currentTimezone : string|null = null
-
Currently selected timezone
Tags
Return values
array<string, array<string|int, array{value: string, label: string, selected: bool}>> —Grouped timezones
boot()
Initialize the application.
boot(string $ConfigPath) : Scheduler|null
Parameters
- $ConfigPath : string
Tags
Return values
Scheduler|nullscheduler()
Run the application.
scheduler(Scheduler $App, array<string|int, mixed> $argv) : void
Parameters
- $App : Scheduler
- $argv : array<string|int, mixed>
Tags
dispatch()
Dispatch a job to the queue for background processing
dispatch(IJob $job[, array<string|int, mixed> $args = [] ][, string|null $queue = null ][, int $delay = 0 ]) : string
Parameters
- $job : IJob
-
Job instance to queue
- $args : array<string|int, mixed> = []
-
Arguments to pass to the job
- $queue : string|null = null
-
Queue name (null = default)
- $delay : int = 0
-
Delay in seconds before job is available
Tags
Return values
string —Job ID
dispatchNow()
Execute a job immediately (synchronously), bypassing the queue
dispatchNow(IJob $job[, array<string|int, mixed> $args = [] ]) : mixed
Useful for testing or when you want to ensure a job runs in the current process without queueing.
Parameters
- $job : IJob
-
Job instance to execute
- $args : array<string|int, mixed> = []
-
Arguments to pass to the job
Tags
Return values
mixed —Job result
getQueueManager()
Get the queue manager instance from registry
getQueueManager() : QueueManager
Creates a new instance if one doesn't exist.
Return values
QueueManagerqueueSize()
Get the size of a queue
queueSize([string|null $queue = null ]) : int
Parameters
- $queue : string|null = null
-
Queue name (null = default)
Tags
Return values
int —Number of jobs in queue
clearQueue()
Clear all jobs from a queue
clearQueue([string|null $queue = null ]) : int
Parameters
- $queue : string|null = null
-
Queue name (null = default)
Tags
Return values
int —Number of jobs cleared