Neuron-PHP

DatabaseContactSubmissionRepository
in package
implements IContactSubmissionRepository

Database-backed contact submission repository.

Works with SQLite, MySQL, and PostgreSQL. Submissions are persisted before the notification email is sent so nothing is lost if delivery fails. The dynamic per-form field values live in the JSON payload column.

Table of Contents

Interfaces

IContactSubmissionRepository
Contract for persisting and retrieving contact form submissions.

Properties

$_pdo  : PDO

Methods

__construct()  : mixed
create()  : int
Insert a submission and return its new id.
delete()  : bool
Delete a submission by id.
findById()  : array<string, mixed>|null
Find a submission by id.
formKeys()  : array<int, string>
Distinct form keys present in stored submissions (for filter UI).
markDelivered()  : bool
Mark a submission as delivered (sets delivered + delivered_at).
paginate()  : array{items: array>, total: int, page: int, per_page: int, pages: int}
Return a page of submissions, newest first, optionally filtered by form key.

Properties

Methods

create()

Insert a submission and return its new id.

public create(array<string|int, mixed> $data) : int
Parameters
$data : array<string|int, mixed>

Row data (payload should already be json_encoded)

Tags
inheritDoc
Return values
int

The inserted row id

findById()

Find a submission by id.

public findById(int $id) : array<string, mixed>|null
Parameters
$id : int
Tags
inheritDoc
Return values
array<string, mixed>|null

Associative row, or null when not found

formKeys()

Distinct form keys present in stored submissions (for filter UI).

public formKeys() : array<int, string>
Tags
inheritDoc
Return values
array<int, string>

markDelivered()

Mark a submission as delivered (sets delivered + delivered_at).

public markDelivered(int $id) : bool
Parameters
$id : int
Tags
inheritDoc
Return values
bool

paginate()

Return a page of submissions, newest first, optionally filtered by form key.

public paginate([int $page = 1 ][, int $perPage = 25 ][, string|null $formKey = null ]) : array{items: array>, total: int, page: int, per_page: int, pages: int}
Parameters
$page : int = 1

Page number (1-based)

$perPage : int = 25

Items per page

$formKey : string|null = null

Optional form key filter

Tags
inheritDoc
Return values
array{items: array>, total: int, page: int, per_page: int, pages: int}
On this page

Search results