Download the PHP package pinoox/devdb without Composer

On this page you can find all versions of the php package pinoox/devdb. 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 devdb

DevDB

DevDB is a development-only database component for PHP projects. It gives you a small local database with a raw SQL translator for common development queries, so you can build and test features without installing MySQL, PostgreSQL, or SQLite.

DevDB uses SQLite when available and automatically falls back to a zero-dependency JSON database when it is not.

DevDB is designed for local development, prototypes, tests, demos, package examples, and single-user tooling. It is not a production database.

Why DevDB?

Use DevDB when you want a project to run immediately on a developer machine, CI job, demo environment, or package example without asking people to install and configure a database server first.

DevDB is useful for:

DevDB is not meant for:

The short version: DevDB removes setup friction during development. Use it to start fast, test ideas, and keep examples portable. Switch to SQLite or a real database when correctness, scale, concurrency, or production reliability matters.

Table of Contents

Features

Installation

Normal PHP Usage

Use Pinoox\DevDB\DevDatabase when you want DevDB as a standalone component outside any framework.

You can also run write statements and inspect the result:

PDO and mysqli-like Adapters

DevDB cannot replace PHP's built-in PDO or mysqli extensions transparently. Those extensions talk to real database drivers. For plain PHP projects, DevDB provides lightweight compatibility adapters with familiar method names.

PDO-like usage

Supported common methods include query(), exec(), prepare(), execute(), bindValue(), fetch(), fetchAll(), fetchColumn(), rowCount(), lastInsertId(), beginTransaction(), commit(), and rollBack().

mysqli-like usage

Supported common methods and properties include query(), fetch_assoc(), fetch_object(), fetch_array(), fetch_all(), num_rows, affected_rows, insert_id, real_escape_string(), begin_transaction(), commit(), and rollback().

Using DevDB in Pinoox

Install DevDB as a development dependency in your app or platform:

Recommended local environment:

With Pinoox integration enabled, normal app code can continue to use models, migrations, and database facades:

DevDB is intended for local development only. Production environments should use a real database connection.

Using DevDB in Laravel

DevDB includes a Laravel-compatible connection class. You can register it manually through Laravel's database extension mechanism.

Example service provider:

Example config/database.php connection:

Example .env:

Then you can use Laravel's database API:

Laravel migrations may require project-specific integration because DevDB stores schema metadata instead of executing all SQL DDL in JSON mode.

Storage Format

DevDB stores data under the configured path.

Default standalone example:

JSON engine files:

schema.json describes tables and columns. Each table has a JSON data file under data/. Auto-increment values are stored in meta/sequences.json.

Compatibility Matrix

DevDB aims to cover the SQL and query behavior developers commonly hit while building local apps, tests, examples, and demos. It is intentionally conservative: unsupported features fail with a clear DevDbException instead of silently pretending to be a full database server.

Area Status Notes
CRUD query builder Supported insert, update, delete, first, get, count, exists, pagination-style limits
Raw SELECT Supported aliases, WHERE, ORDER BY, GROUP BY, HAVING, LIMIT, OFFSET, DISTINCT
Joins Partial inner and left joins with common ON conditions, including grouped AND/OR predicates
Aggregates Supported COUNT, SUM, AVG, MIN, MAX
SQL functions Partial common scalar/date/string/math functions used in development queries, plus helpers such as IF, GREATEST, LEAST, LEFT, RIGHT, and DATE_FORMAT
Schema SQL Partial common CREATE, DROP, ALTER, SHOW, DESCRIBE, and index statements
MySQL dump imports Partial common dump syntax, comments, SET, AUTO_INCREMENT, table options, and multi-statement execution
Constraints Partial strict checks for NOT NULL, ENUM, UNIQUE, primary keys, and simple foreign keys
Transactions Development-safe snapshot-backed rollback, not isolation-level database transactions
Locks Compatibility no-op LOCK TABLES and UNLOCK TABLES are accepted but do not provide real locking
Advanced SQL Partial UNION, UNION ALL, simple subqueries, scalar subqueries, and simple views are supported

Raw SQL Support

DevDB translates common raw SQL statements into JSON operations.

Supported data statements:

Supported SELECT features:

Supported operators and predicates:

Supported development helpers:

Supported aggregate functions:

Supported scalar functions:

Example:

Schema SQL Support

DevDB can translate common schema and introspection statements into metadata operations.

DevDB also accepts common MySQL dump compatibility syntax such as:

In strict mode, DevDB validates common development constraints while inserting or updating rows:

Supported schema statements:

Supported introspection statements:

Example:

Snapshots and Change Manifests

DevDB can create named snapshots of the full schema, data, and metadata export.

List and delete snapshots:

DevDB can also write a manifest of tracked files and later detect whether any tracked JSON data changed.

Tracked files include schema.json, table data files, and core metadata files. Snapshot files and the manifest file itself are ignored to avoid false positives.

Standalone API

DevDatabase::open()

createTable()

select()

selectOne()

statement()

execute()

executeDump()

executeDump() splits and executes multi-statement SQL dumps. It ignores common SQL comments and accepts compatibility statements such as SET NAMES utf8mb4, SET FOREIGN_KEY_CHECKS = 0, CREATE DATABASE, DROP DATABASE, and USE as local no-op operations.

explain()

explain() returns a small debug plan with the parsed table, alias, joins, filters, ordering, and limits. It is useful when a raw query does not behave the way you expected.

strict()

Strict mode is enabled by default. It validates NOT NULL, ENUM, UNIQUE, primary key, and simple foreign key constraints. Disable it only for loose development imports where you prefer loading imperfect fixture data over failing fast.

store()

clear()

snapshot()

snapshots()

restoreSnapshot()

deleteSnapshot()

writeManifest()

hasChangesSinceManifest()

Laravel-Compatible Connection

The lower-level connection class is:

Example:

CLI Commands

Available command names and what they do:

Command Purpose
devdb:status Show the active DevDB engine, storage path, tables, row counts, and migration count.
devdb:inspect <table> Inspect one table, including columns, indexes, primary key, row count, and sample rows.
devdb:export [file] Export the full DevDB payload as JSON.
devdb:export:mysql [file] Export DevDB as a MySQL-compatible SQL dump for phpMyAdmin or MySQL imports.
devdb:import:mysql <file> Import a MySQL/phpMyAdmin SQL dump into DevDB.
devdb:sync:mysql Sync DevDB directly into a local MySQL database through pdo_mysql.
devdb:doctor Check DevDB storage health and report common issues.
devdb:repair Repair common metadata issues such as stale sequences.
devdb:benchmark Run a small insert/select/count benchmark against the current DevDB storage.
devdb:compat Show a MySQL compatibility report with supported, partial, metadata-only, and unsupported areas.
devdb:snapshot [action] [name] Create, list, restore, or delete snapshots.
devdb:clear Clear DevDB storage. Requires confirmation unless --force is used.
devdb:seed [package] Run app seeders against DevDB in a Pinoox host application.

Check Status

Use devdb:status to see where DevDB stores data, which engine is active, and which tables exist.

JSON output is useful for tools and automation:

Inspect a Table

Use devdb:inspect when you want to quickly check a table structure and a few rows:

Limit the number of previewed rows:

Return JSON instead of a console table:

Export as JSON

Use devdb:export to create a portable DevDB backup or debug artifact:

If no file is provided, the JSON is printed to the console:

Export for phpMyAdmin or MySQL

Use devdb:export:mysql when you want to inspect DevDB data in phpMyAdmin. The command generates a MySQL-compatible SQL file:

Then import storage/devdb/devdb.sql into phpMyAdmin.

By default the dump includes DROP TABLE IF EXISTS statements so repeated imports are easier during development. Disable that with:

Export only schema or only data:

Export specific tables:

Import from MySQL or phpMyAdmin

Use devdb:import:mysql when you have a MySQL dump and want to load it into DevDB:

For loose fixture imports where you do not want strict constraints to block loading:

Sync Directly to MySQL

Use devdb:sync:mysql when you have a local MySQL or MariaDB server and want DevDB copied into it automatically:

You can also pass a full PDO DSN:

Available MySQL options:

Option Description
--dsn Full PDO MySQL DSN. Overrides --host, --port, and --database.
--host MySQL host. Defaults to 127.0.0.1 or DEVDB_MYSQL_HOST.
--port MySQL port. Defaults to 3306 or DEVDB_MYSQL_PORT.
--database Target MySQL database. Required unless --dsn is provided.
--username MySQL username. Defaults to root or DEVDB_MYSQL_USERNAME.
--password MySQL password. Defaults to DEVDB_MYSQL_PASSWORD.
--no-drop Do not drop existing tables before syncing.
--schema-only Sync schema without row data.
--data-only Sync row data without schema.
--tables Comma-separated table list to sync.
--dry-run Show what would be synced without connecting to MySQL.

Direct sync requires the pdo_mysql PHP extension. If it is not available, use devdb:export:mysql and import the SQL file manually through phpMyAdmin.

Preview a sync:

Check and Repair DevDB

Use devdb:doctor to inspect storage health:

Use devdb:repair to recreate missing data files, refresh metadata, update stale sequences, and write a fresh manifest:

Snapshots

Snapshots are useful before running destructive experiments or imports:

Clear DevDB

Use devdb:clear to delete the local DevDB data and metadata:

By default, DevDB creates a snapshot before clearing. Disable that with:

Skip the confirmation prompt in scripts:

Run Seeders

In a Pinoox host application, devdb:seed forces the database connection to DevDB and runs app seeders:

Run only one seeder class:

Continue when a seeder fails:

Environment Variables

The commands read the normal DevDB environment values:

The MySQL sync command can also read:

Command registration depends on the host application or framework.

Troubleshooting

SQLite is not installed

DevDB uses SQLite when pdo_sqlite is available. If it is not available, DevDB automatically uses the JSON engine. No extra setup is required.

MySQL sync fails

Direct sync requires pdo_mysql and a reachable MySQL or MariaDB database. If pdo_mysql is missing, run:

Then import the file manually through phpMyAdmin.

A query is not supported

DevDB throws a clear exception for unsupported SQL. Try simplifying the query, using the SQLite engine, or syncing to MySQL for exact server behavior.

IDs look wrong after editing JSON files

Run:

This refreshes sequence metadata from table data.

Performance Expectations

DevDB is optimized for local development, small demos, tests, and package examples.

Limitations

DevDB is intentionally development-first, not a replacement for a full SQL server.

The remaining limitations are intentionally narrow:

DevDB supports common UNION, UNION ALL, simple subqueries, scalar subqueries, simple views, compatibility locks, many MySQL-style functions, CASE, ON DUPLICATE KEY UPDATE, ROW_NUMBER(), simple foreign key validation, and basic ON DELETE CASCADE / SET NULL behavior. Trigger, procedure, and function definitions from dumps are accepted as metadata for compatibility, but they are not executed. When a query is still not supported, DevDB throws a clear exception. For exact SQL-server behavior, use SQLite, MySQL, PostgreSQL, or another real database engine.

Package Structure

Development

Validate the package:

Run the package test suite:

Run the full quality gate:

Run only one layer:

Lint source files:

Run the host project's DevDB test suite when integrating the package with a framework.

License

MIT


All versions of devdb with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/database Version ^12.0
symfony/console Version ^7.2
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 pinoox/devdb contains the following files

Loading the files please wait ...