PHPackages                             vaibhavpandeyvpz/kram - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. vaibhavpandeyvpz/kram

ActiveLibrary[Database &amp; ORM](/categories/database)

vaibhavpandeyvpz/kram
=====================

Simple and deterministic database migration and versioning library built on top of databoss

1.0.0(4mo ago)2281MITPHPPHP ^8.2CI passing

Since Dec 29Pushed 4mo agoCompare

[ Source](https://github.com/vaibhavpandeyvpz/kram)[ Packagist](https://packagist.org/packages/vaibhavpandeyvpz/kram)[ Docs](https://github.com/vaibhavpandeyvpz/kram)[ RSS](/packages/vaibhavpandeyvpz-kram/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (1)

vaibhavpandeyvpz/kram
=====================

[](#vaibhavpandeyvpzkram)

[![Latest Version](https://camo.githubusercontent.com/fe23590e83a8f8df96ef957142d6a409d22eb6bcf839ccbeb7ad27bae4b72021/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7661696268617670616e64657976707a2f6b72616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vaibhavpandeyvpz/kram)[![PHP Version](https://camo.githubusercontent.com/439f8d38423e3823b5ce3d8accb458b7e123c33fc789bf32d027c59bf31dcfac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7661696268617670616e64657976707a2f6b72616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vaibhavpandeyvpz/kram)[![Build Status](https://camo.githubusercontent.com/56fa3e782ae7d7335672bf900291c328568d6a9277702b4e2d0fbd3d6c96a397/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7661696268617670616e64657976707a2f6b72616d2f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://github.com/vaibhavpandeyvpz/kram/actions)[![License](https://camo.githubusercontent.com/143a43a7438ad2835656bf6880743ddf48329f2d7ca80625c196775dc400aa89/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7661696268617670616e64657976707a2f6b72616d2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

**Kram** (क्रम) is a simple and deterministic database migration and versioning library built on top of [databoss](https://github.com/vaibhavpandeyvpz/databoss). It provides a clean, straightforward API for managing database schema changes across MySQL/MariaDB, PostgreSQL, SQLite, and Microsoft SQL Server databases.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Migration Files](#migration-files)
- [Usage](#usage)
- [Migration Versioning](#migration-versioning)
- [How It Works](#how-it-works)
- [Custom Table Name](#custom-table-name)
- [Database Support](#database-support)
- [Error Handling](#error-handling)
- [Advanced Features](#advanced-features)
- [Best Practices](#best-practices)
- [Testing](#testing)
- [API Reference](#api-reference)
- [Troubleshooting](#troubleshooting)
- [License](#license)

Features
--------

[](#features)

- **Simple and Deterministic**: Migrations are executed in a predictable order based on version numbers
- **Multi-database Support**: Works with MySQL/MariaDB, PostgreSQL, SQLite, and Microsoft SQL Server (via databoss)
- **Flexible Migration Types**: Supports both SQL file-based and PHP class-based migrations
- **Exception-based Error Handling**: Clean exception-based error handling for migration failures
- **Version Tracking**: Automatically tracks executed migrations in a database table
- **Rollback Support**: Easily rollback migrations to a specific version or rollback the last N migrations
- **Type-safe**: Full PHP 8.2+ type declarations throughout
- **Modern PHP**: Built with enums, match expressions, readonly properties, and more

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2
- [vaibhavpandeyvpz/databoss](https://github.com/vaibhavpandeyvpz/databoss) ^2.1 (automatically installed as dependency)

Installation
------------

[](#installation)

```
composer require vaibhavpandeyvpz/kram
```

Quick Start
-----------

[](#quick-start)

### Basic Setup

[](#basic-setup)

```
