Download the PHP package visorcraft/mongreldb-php without Composer

On this page you can find all versions of the php package visorcraft/mongreldb-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mongreldb-php

MongrelDB PHP Client

Pure PHP client for MongrelDB - embedded+server database with SQL, vector search, full-text search, and AI-native retrieval.

Packagist PHP

Package

Surface Package Install
PHP client visorcraft/mongreldb-php composer require visorcraft/mongreldb-php

Requirements

What It Provides

Examples

Runnable, commented examples live in examples/:

Quick Example

Authentication

Batch transactions

Operations are staged locally and committed atomically. The engine enforces unique, foreign key, and check constraints at commit time.

Native query builder

Conditions push down to the engine's specialized indexes. The builder accepts friendly aliases that are translated to the server's on-wire keys: column (-> column_id), min/max (-> lo/hi). The canonical keys are also accepted directly.

SQL

ANN index backends

The engine's ann index is swappable across three backends - hnsw (the default), diskann, and ivf - selected with the algorithm option. Quantization is independently configurable: dense, binary_sign, or product (product quantization, with num_subvectors, bits_per_subvector, pq_training_samples, pq_seed, and pq_rerank_factor). These are ordinary DDL strings run through sql, so no client changes are needed.

User & role management

Performance: persistent cURL sharing (PHP 8.5+)

By default the client pools keep-alive connections within a single PHP request. On PHP 8.5+, opt in to sharing DNS resolution, TLS sessions, and the connection pool across requests (e.g. between PHP-FPM invocations) for further latency reductions on the same daemon host:

Off by default; silently degrades to per-request pooling on PHP 8.4. CURL_LOCK_DATA_COOKIE is rejected - it would leak cookies across requests and is unsafe for a stateless database client.

Custom HTTP transport

Error handling

Enum-domain failures and regex/check-constraint failures are reported by the server as ConstraintException with $e->errorCode === 'CHECK_VIOLATION'.

API reference

Database class

Method Description
health(): bool Check daemon health
historyRetentionEpochs(): int Current history-retention window (epochs)
earliestRetainedEpoch(): int Oldest epoch still queryable with AS OF EPOCH
setHistoryRetentionEpochs(int $epochs): array Set the history-retention window; requires admin
tables(): array List table names
createTable(string $name, array $columns, array $constraints = [], array $indexes = []): int Create a table with all index definitions
dropTable(string $name): void Drop a table
count(string $table): int Row count
put(string $table, array $cells, ?string $idempotencyKey): array Insert a row
upsert(string $table, array $cells, ?array $updateCells, ?string $idempotencyKey): array Upsert a row
delete(string $table, int $rowId): void Delete by row ID
deleteByPk(string $table, mixed $pk): void Delete by primary key
query(string $table): QueryBuilder Start a native query
sql(string $sql): array Execute SQL
schema(): array Full schema catalog
schemaFor(string $table): array Single table schema
createUser(string $user, string $pw): void Create a user
dropUser(string $user): void Drop a user
alterPassword(string $user, string $pw): void Change a password
verifyUser(string $user, string $pw): bool Verify credentials
setUserAdmin(string $user, bool $isAdmin): void Grant/revoke admin
users(): array List users (row objects with a username key)
createRole(string $name): void Create a role
dropRole(string $name): void Drop a role
roles(): array List roles (row objects with a role key)
grantRole(string $user, string $role): void Grant role to user
revokeRole(string $user, string $role): void Revoke role from user
grantPermission(string $role, string $perm): void Grant permission
revokePermission(string $role, string $perm): void Revoke permission
procedures(): array List procedures
procedure(string $name): array Get a procedure
createProcedure(array $proc): array Install/replace a procedure
dropProcedure(string $name): void Drop a procedure
callProcedure(string $name, array $args): mixed Call a procedure
compact(): array Compact all tables
compactTable(string $name): array Compact one table
beginTransaction(): Transaction Start a batch

createTable() forwards each column array unchanged in the columns payload. Column specs accept the standard keys (id, name, ty, primary_key, nullable, auto_increment, encrypted, encrypted_indexable) plus:

Column key Description
enum_variants String variants for ty => 'enum'; required and non-empty for enum columns
default_value Static JSON scalar default filled in when a row omits the column. Explicit null stays a static null; a missing key means no default. Literal strings "now" or "uuid" here are static, not dynamic.
default_expr Dynamic default expression; only "now" and "uuid" are accepted by the server. Use this instead of default_value for dynamic defaults.

All supported static-default shapes pass through with their original JSON types:

Table-level check constraints are passed as the optional third argument under constraints.checks:

QueryBuilder class

Method Description
where(string $type, array $params): static Add a native condition
projection(array $columnIds): static Set column projection
limit(int $limit): static Set row limit
offset(int $offset): static Skip matching rows before the limit
build(): array Build the request payload
execute(): array Run the query

Transaction class

Method Description
put(string $table, array $cells): static Stage an insert
upsert(string $table, array $cells, ?array $updateCells): static Stage an upsert
delete(string $table, int $rowId): static Stage a delete
deleteByPk(string $table, mixed $pk): static Stage a delete by PK
commit(?string $idempotencyKey): array Commit atomically
rollback(): void Discard all operations
count(): int Number of staged operations

Building and testing

The project uses PHPUnit 12 and has two testsuites:

The unit suite exercises the HTTP contract, SQL-injection hardening, JSON edge cases (INF/NAN, malformed UTF-8, recursion), transport behavior, transaction state machines, and the optional persistent-sharing feature.

Contributing

Contributions are welcome. Please:

  1. Open an issue first for non-trivial changes.
  2. Add focused tests near your change - the suite must stay green.
  3. Keep PHP 8.4 as the minimum supported version (PHP 8.5-only features must degrade gracefully, detected at runtime via function_exists/defined).
  4. Match the existing style: strict types, declare(strict_types=1), tabs, readonly properties where applicable, and #[\Override] on overridden methods.

History retention

History retention controls how far back AS OF EPOCH time-travel queries can read. Use these methods with mongreldb-server 0.48.0+:

Related tools

License

Dual-licensed under the MIT License or the Apache License, Version 2.0, at your option. See Apache-2.0 for the full text.

SPDX-License-Identifier: MIT OR Apache-2.0


All versions of mongreldb-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package visorcraft/mongreldb-php contains the following files

Loading the files please wait ...