PHPackages                             portable-content/portable-content-php - 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. portable-content/portable-content-php

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

portable-content/portable-content-php
=====================================

PHP implementation of portable content system - Mutable Architecture with AbstractBlock v0.4.0

0.4.0(10mo ago)062Apache-2.0PHPPHP ^8.3CI passing

Since Aug 23Pushed 10mo agoCompare

[ Source](https://github.com/portable-content/portable-content-php)[ Packagist](https://packagist.org/packages/portable-content/portable-content-php)[ Docs](https://github.com/portable-content/portable-content-php)[ RSS](/packages/portable-content-portable-content-php/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (9)Versions (6)Used By (0)

Portable Content PHP
====================

[](#portable-content-php)

[![Version](https://camo.githubusercontent.com/bac54a8ca493013448b7115a677c10a42728e3fdd23f1ae3a8b0a16bfefcb8e9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d302e342e302d626c75652e737667)](https://github.com/portable-content/portable-content-php/releases/tag/v0.4.0)[![codecov](https://camo.githubusercontent.com/8188f336bfb7712c8fac7cf8378f7565270cdba8aea906d893debee5c0b4f212/68747470733a2f2f636f6465636f762e696f2f67682f706f727461626c652d636f6e74656e742f706f727461626c652d636f6e74656e742d7068702f67726170682f62616467652e7376673f746f6b656e3d56356938385368583838)](https://codecov.io/gh/portable-content/portable-content-php)[![PHP Version](https://camo.githubusercontent.com/c8d8dad6beb757a2b8acba331d16140813699543b88a37af0a81f20bd35f61de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d626c7565)](https://camo.githubusercontent.com/c8d8dad6beb757a2b8acba331d16140813699543b88a37af0a81f20bd35f61de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d626c7565)[![PHPStan Level](https://camo.githubusercontent.com/942bdbddc7b2adea1d63ed80793492d06d72ef41911edcba33310d0745581548/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230392d627269676874677265656e)](https://camo.githubusercontent.com/942bdbddc7b2adea1d63ed80793492d06d72ef41911edcba33310d0745581548/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230392d627269676874677265656e)[![Tests](https://camo.githubusercontent.com/9e8612d0fbbb903fcb049a31601d486dbc7faf3c43bf6023375ddf7209d6fb91/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d33313525323070617373696e672d627269676874677265656e)](https://camo.githubusercontent.com/9e8612d0fbbb903fcb049a31601d486dbc7faf3c43bf6023375ddf7209d6fb91/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d33313525323070617373696e672d627269676874677265656e)[![License](https://camo.githubusercontent.com/53aec1ae7394521e2af38df6c1560d97fcb8152f5edd45d87563432eed72bf7a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d417061636865253230322e302d626c7565)](https://camo.githubusercontent.com/53aec1ae7394521e2af38df6c1560d97fcb8152f5edd45d87563432eed72bf7a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d417061636865253230322e302d626c7565)

A robust PHP library for managing portable content with comprehensive validation, sanitization, and flexible storage backends.

✨ Key Features
--------------

[](#-key-features)

- **🏗️ Mutable Domain Objects** - Flexible ContentItem and MarkdownBlock entities with proper encapsulation
- **🧱 AbstractBlock Architecture** - Extensible base class for all block types
- **🔒 Type-Safe Validation** - Comprehensive input validation and sanitization
- **💾 Repository Pattern** - Clean abstraction with capability discovery system
- **🧪 Comprehensive Testing** - 315 tests with 1,669 assertions
- **📚 Complete Documentation** - 7 detailed guides covering all aspects
- **⚡ Production Ready** - PHPStan Level 9, zero static analysis errors
- **🧹 Clean Architecture** - Focused, maintainable codebase with extensible design

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

[](#requirements)

- PHP 8.3 or higher
- Composer
- SQLite (included with PHP)

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

[](#installation)

```
git clone https://github.com/portable-content/portable-content-php.git
cd portable-content-php
composer install
```

Database Setup
--------------

[](#database-setup)

### Initialize Database

[](#initialize-database)

```
# Create database with migrations
composer migrate

# Or specify custom path
php bin/migrate.php --path=storage/custom.db

# Test with in-memory database
composer migrate-test
```

### Database Schema

[](#database-schema)

The system uses SQLite with two main tables:

- **content\_items**: Stores ContentItem metadata (id, type, title, summary, timestamps)
- **markdown\_blocks**: Stores MarkdownBlock content (id, content\_id, source, timestamp)

Foreign key constraints ensure data integrity between content and blocks.

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

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
