Download the PHP package sobhanmohammadi/arxaron without Composer
On this page you can find all versions of the php package sobhanmohammadi/arxaron. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sobhanmohammadi/arxaron
More information about sobhanmohammadi/arxaron
Files in sobhanmohammadi/arxaron
Package arxaron
Short Description Arxaron — a secure, robust, high-performance PHP database library built directly on mysqli (no PDO), with a fluent query builder, active-record models, transactions, and optional Redis (predis) caching.
License MIT
Informations about the package arxaron
Arxaron
Package: sobhanmohammadi/arxaron
A secure, robust, and performant database library for PHP 8.3, 8.4, and 8.5 —
built directly on mysqli (never PDO), with a fluent query builder,
an optional active-record layer, real transactions with savepoints, and
first-class Redis query caching via predis/predis.
📖 See
docs/GUIDE.mdfor the complete, in-depth usage guide — every method, every config option, transactions, caching, security model, troubleshooting, and a full end-to-end example. This README is just a quick start.
Why this exists
mysqli-only. No PDO anywhere in the stack, including for prepared statements — everything goes throughmysqli_stmt.- Security by construction. All values are bound as prepared-statement
parameters. Table/column names are validated against a strict whitelist
pattern and backtick-quoted.
update()/delete()refuse to run without aWHEREclause unless you explicitly opt out. - Robust. Automatic, bounded reconnect-and-retry on transient errors
("MySQL server has gone away"), nested transactions via
SAVEPOINT, deadlock-aware transaction retries, and connection error messages that never leak credentials. - Fast. Prepared statement reuse per call, buffered or streamed
(
cursor()) result fetching, and an optional Redis cache layer with tag-based invalidation that fails open (a cache outage never breaks your app — it just stops caching). - PHP 8.3 – 8.5 compatible. Uses only stable, non-deprecated APIs
(readonly properties, enums-free,
match, named arguments) so it runs unmodified across the 8.3/8.4/8.5 line.
Installation
Quick start
Query builder
Grouped conditions:
Writes:
update() and delete() throw a QueryException if you forget a WHERE
clause — use ->whereRaw('1=1') to explicitly confirm a full-table
operation.
Transactions
Nested transaction() calls automatically use SAVEPOINTs. Deadlocks
(MySQL error 1213) and lock-wait timeouts (1205) at the outermost level are
retried automatically with a small randomized backoff.
Redis query caching
Cache reads/writes are fail-open: if Redis is unreachable, Arxaron transparently falls back to querying MySQL directly rather than throwing.
Active record (optional)
Streaming large result sets
Multiple connections
Configuration reference (Config)
| Option | Default | Notes |
|---|---|---|
host |
— | Prefix with p: (or set persistent: true) for a persistent connection. |
username / password |
— | |
database |
— | |
port |
3306 |
|
socket |
null |
Unix socket path, if used instead of TCP. |
charset |
utf8mb4 |
|
ssl_enabled |
false |
Plus ssl_key, ssl_cert, ssl_ca_cert, ssl_ca_path, ssl_cipher. |
connect_timeout |
5 |
Seconds. |
read_timeout |
0 (system default) |
Seconds. |
strict_mode |
true |
Sets strict sql_mode + isolation level on connect. |
isolation_level |
REPEATABLE READ |
One of the four standard SQL levels. |
max_reconnect_attempts |
2 |
Bounded automatic retry on transient connection errors. |
Security notes
- Every value ever placed into SQL is sent via
mysqli_stmt::bind_param. There is no string-concatenation path for values. - Table/column identifiers passed as plain strings are validated against
^[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)?$and backtick-quoted (with embedded backticks doubled) before use. whereRaw()/selectRaw()are explicit, clearly named escape hatches for expressions that can't be expressed otherwise (e.g.COUNT(*)); callers are responsible for never interpolating untrusted input into them.- Connection errors are sanitized so
(using password: YES/NO)-style fragments never leak into logs or exceptions. - Cached values are
serialize()d butunserialize()d withallowed_classes => false, preventing PHP object-injection even if a cache backend were ever compromised.
Requirements
- PHP 8.3, 8.4, or 8.5
ext-mysqlipredis/predis^2.2 or ^3.0 (only if you use Redis caching)
License
MIT
All versions of arxaron with dependencies
ext-mysqli Version *
ext-json Version *