Releases: portable-content/portable-content-php
Release list
v0.4.0: Mutable MarkdownBlock with AbstractBlock Architecture
π BREAKING CHANGES: Mutable MarkdownBlock with AbstractBlock Architecture
This release introduces a major architectural improvement by converting MarkdownBlock from immutable to mutable design and adding an AbstractBlock base class for extensibility.
β¨ What's New
AbstractBlock Base Class
- New extensible foundation for all block types
- Common functionality shared across all blocks (ID, timestamps, helper methods)
- Easy extensibility for future block types (CodeBlock, HtmlBlock, etc.)
Mutable MarkdownBlock
- Direct modification with
setSource(),setId(),setCreatedAt()methods - Proper encapsulation with private properties and getter/setter methods
- Better performance - no object creation overhead for updates
Enhanced Architecture
- Clean inheritance hierarchy with AbstractBlock providing common functionality
- Improved code organization and maintainability
- Foundation for future features - easy to add new block types
π¨ Breaking Changes
Property Access:
// β Before (v0.3.0)
$source = $block->source;
$id = $block->id;
// β
After (v0.4.0)
$source = $block->getSource();
$id = $block->getId();Block Updates:
// β Before (v0.3.0)
$updated = $block->withSource('New content');
// β
After (v0.4.0)
$block->setSource('New content');π Migration Guide
- Update Property Access - Replace direct property access with getter methods
- Update Modifications - Replace
withSource()withsetSource() - Update Repository Code - Use getters in any custom repository implementations
- Update Tests - Modify test assertions to use new getter/setter methods
See CHANGELOG.md for detailed migration instructions.
ποΈ Future Block Types Made Easy
The new AbstractBlock makes it simple to add new block types:
class CodeBlock extends AbstractBlock
{
private string $language;
private string $code;
// Inherits common functionality from AbstractBlock
// Easy to implement required abstract methods
}π Quality Metrics
- β All 315 tests passing with 1,669 assertions
- β PHPStan Level 9 compliance (zero static analysis errors)
- β Complete documentation updated for new architecture
- β Backward compatibility through proper encapsulation
π§ Technical Details
- PHP 8.3+ compatibility maintained
- No database changes required
- All validation logic preserved
- Enhanced extensibility for future development
Full Changelog: v0.3.0...v0.4.0
v0.3.0: Entity Architecture
π Major Release: Entity Architecture v0.3.0
π¨ BREAKING CHANGE: ContentItem Entity Conversion
This release converts ContentItem from an immutable value object to a mutable entity, representing a significant architectural shift that improves usability while maintaining data integrity.
β¨ What's New
π§ Enhanced ContentItem API
- Getter Methods - Complete encapsulation with
getId(),getType(),getTitle(),getSummary(),getBlocks(),getCreatedAt(),getUpdatedAt() - Setter Methods - Mutable operations with
setType(),setTitle(),setSummary(),setBlocks(),addBlock() - Automatic Timestamps -
updatedAtautomatically updated when properties change - Enhanced Validation - All validation logic preserved in setter methods
ποΈ Architectural Improvements
- Better Encapsulation - Proper object-oriented design with private properties
- Maintained Validation - All business rules and validation logic preserved
- Type Safety - Full type hints and static analysis compliance maintained
- Test Coverage - All 315 tests updated and passing with 1,673 assertions
π Migration Guide
Before (v0.2.0 - Immutable Value Object)
// Property access
$title = $content->title;
$blocks = $content->blocks;
// Updates (created new instances)
$updated = $content->withTitle('New Title');
$withBlocks = $content->withBlocks([$block1, $block2]);
$withNewBlock = $content->addBlock($newBlock);After (v0.3.0 - Mutable Entity)
// Property access (use getters)
$title = $content->getTitle();
$blocks = $content->getBlocks();
// Updates (modify same object)
$content->setTitle('New Title');
$content->setBlocks([$block1, $block2]);
$content->addBlock($newBlock); // void returnπ Migration Steps
- Update Property Access - Replace direct property access with getter methods
- Update Modifications - Replace
with*methods withset*methods - Handle Return Values -
addBlock()now returnsvoidinstead ofself - Update Tests - Modify test assertions to use new getter methods
ποΈ Removed Features
- Immutable Methods - Removed
withTitle(),withSummary(),withBlocks()methods - Public Properties - All properties now private (breaking change)
- Method Chaining - Removed fluent interface for content modification
π Impact & Benefits
- Breaking Change - Requires code updates for property access and modification patterns
- Improved Usability - More intuitive mutable entity pattern
- Better Performance - Eliminates object creation overhead for updates
- Enhanced Maintainability - Cleaner separation between data and behavior
β Compatibility
- PHP Version - Still requires PHP 8.3+
- Dependencies - No changes to external dependencies
- Database Schema - No database changes required
- Validation Rules - All validation logic unchanged
π§ͺ Quality Assurance
- β 315 tests passing (100% success rate)
- β 1,673 assertions all successful
- β PHPStan Level 9 - Zero static analysis errors
- β Full test coverage - Unit and integration tests
- β Backward compatibility - Database and validation layers unchanged
π Documentation Updates
- Updated
CHANGELOG.mdwith comprehensive migration guide - Updated
README.mdwith new API examples - Updated
docs/architecture.mdto reflect entity design patterns - Updated
llms.txtwith new getter/setter API documentation
Full Changelog: v0.2.0...v0.3.0
Need Help? Check the migration guide or open an issue.
v0.2.0
π§Ή Repository Architecture Cleanup
This release focuses on simplifying the repository architecture by removing speculative vector database implementations and focusing on a robust SQLite-only foundation.
β¨ Key Improvements
- Enhanced ContentRepositoryInterface with capability discovery
- Simplified architecture removing speculative implementations
- Library best practices with composer.lock management
- Cleaner, more maintainable codebase (-6,684 lines)
- All 315 tests passing, PHPStan Level 9 compliance
π― Philosophy Shift
Strategic decision to avoid over-engineering and focus on delivering a solid, tested foundation. Vector capabilities will be added when there's genuine demand.
Full Changelog: v0.1.0...v0.2.0
v0.1.0
π Initial Release - Production Ready PHP Content Management Library
This release represents the completed Phase 1A implementation with all goals achieved and exceeded. The Portable Content PHP library is now production-ready with enterprise-grade code quality.
β¨ Key Features
- ποΈ Immutable Domain Objects - Thread-safe ContentItem and MarkdownBlock entities
- π Type-Safe Validation - Comprehensive input validation and sanitization pipeline
- πΎ Repository Pattern - Clean abstraction with optimized SQLite implementation
- π§ͺ Comprehensive Testing - 315 tests with 1,674 assertions
- π Complete Documentation - 7 detailed guides covering all aspects
- β‘ Production Ready - PHPStan Level 9, zero static analysis errors
π― Phase 1A Goals - All Achieved β
- β Content Entity Storage - ContentItem with MarkdownBlock support
- β SQLite Database - Optimized schema with foreign key constraints
- β Repository Pattern - Clean data access abstraction with transaction safety
- β Input Validation - Comprehensive validation and sanitization system
- β Comprehensive Testing - Complete unit and integration test coverage
- β Enterprise Quality - Maximum code quality standards exceeded
π Release Metrics
- Source Code: 2,500+ lines of production PHP 8.3+ code
- Test Coverage: 315 tests, 1,674 assertions
- Documentation: 7 comprehensive guides (50+ pages)
- Code Quality: PHPStan Level 9, zero static analysis errors
- Performance: Handles 1000+ content items efficiently
- Dependencies: Minimal, production-ready dependency set
π Installation
composer require portable-content/portable-content-phpOr clone the repository:
git clone https://github.com/portable-content/portable-content-php.git
cd portable-content-php
composer installπ Documentation
- Getting Started Guide - Complete setup and basic usage
- API Reference - Detailed API documentation
- Architecture Overview - System design and components
- Examples - Common usage patterns and recipes
π§ Technical Highlights
Type Safety & Immutability
- PHP 8.3+ Compatibility with strict typing throughout
- Immutable Domain Objects for thread safety and reliability
- Comprehensive Type Hints with full static analysis compliance
- Defensive Programming with robust error handling
Quality Assurance
- PHPStan Level 9 - Strictest static analysis (0 errors)
- PHP-CS-Fixer - Complete code style standardization
- Comprehensive Testing - Unit and integration test coverage
- CI/CD Pipeline - Automated quality checks and testing
Performance & Scalability
- Optimized Database Queries with efficient SQLite operations
- Memory Management with efficient object lifecycle
- Batch Operations supporting large dataset processing
- Connection Pooling Ready for production scaling
π― Ready For Production
This library is ready for production use in:
- Content Management Systems requiring reliable content storage
- API Backends needing type-safe content validation
- Documentation Systems with markdown content support
- Enterprise Applications requiring maximum code quality
π What's Next - Phase 1B
The next major release will focus on GraphQL API implementation:
- GraphQL Server with complete schema and resolver system
- API Endpoints for query, mutation, and subscription support
- Additional CLI Tools for content management utilities
- Enhanced Block Types including HTML, Code, Image, and Embed blocks
See Future Features for the complete roadmap.
π Full Changelog
See CHANGELOG.md for detailed release notes.
This release represents a production-ready foundation for content management systems with enterprise-grade code quality, comprehensive testing, and complete documentation. The library exceeds industry standards and is ready for community contributions and Phase 1B development.