Repository navigation
v0.4.0 - Complete Interface Enhancement + Auto-Registration
EdgeBinder v0.4.0 - Complete Interface Enhancement + Auto-Registration
This major feature release combines interface enhancement with auto-registration foundation, delivering maximum testability and architectural flexibility while maintaining 100% backward compatibility.
🚀 Major Features
Interface Enhancement for Maximum Testability
- Removed
finalkeywords fromEdgeBinderandBindingQueryBuilderclasses - InMemoryEdgeBinder - Complete in-memory implementation for lightning-fast unit testing
- EdgeBinderTestFactory - Factory class with static methods for creating test instances and mocks
- Comprehensive testing utilities - 24 new tests covering all testing scenarios
Auto-Registration Foundation
- Enhanced AdapterRegistry with advanced management capabilities:
hasAdapter()- Check if adapter is registeredgetRegisteredTypes()- Get all registered adapter typesclear()- Clear registry for testing scenariosunregister()- Remove specific adapter typesgetFactory()- Get factory instance for adapter type
- Idempotent registration - Safe to register same adapter multiple times
- VERSION constant -
EdgeBinder::VERSIONfor compatibility checks and debugging
Developer Experience Revolution
- 10-100x faster unit testing with InMemoryEdgeBinder
- Easy mocking support - Full PHPUnit mock compatibility
- Dependency injection ready - Services can depend on
EdgeBinderInterface - Enhanced error messages - Registry errors show available adapter types
🎯 What's New
Before vs After
Before (Integration Testing Required):
// Slow integration test with real storage
$edgeBinder = new EdgeBinder($weaviateAdapter); // Requires Weaviate running
$service = new RelationshipService($edgeBinder);
// Testing was slow and required external dependenciesAfter (Lightning-Fast Unit Testing):
// Option 1: Direct instantiation
$edgeBinder = new InMemoryEdgeBinder(); // Milliseconds, no dependencies
// Option 2: Factory methods
$edgeBinder = EdgeBinderTestFactory::createInMemory();
$edgeBinder = EdgeBinderTestFactory::createWithTestData([
['from' => $user, 'to' => $project, 'type' => 'owns']
]);
// Option 3: Easy mocking
$mock = $this->createMock(EdgeBinderInterface::class);
$mock->expects($this->once())->method('bind');
$service = new RelationshipService($edgeBinder); // Any implementation!New Testing Capabilities
use EdgeBinder\Testing\{InMemoryEdgeBinder, EdgeBinderTestFactory};
// Fast in-memory testing with helper methods
$edgeBinder = new InMemoryEdgeBinder();
$edgeBinder->bind($user, $project, 'has_access');
// Powerful assertions
assert($edgeBinder->getBindingCount() === 1);
assert($edgeBinder->hasBindings());
assert($edgeBinder->areBound($user, $project));
// Easy cleanup
$edgeBinder->clear();
assert($edgeBinder->getBindingCount() === 0);Enhanced Registry Management
use EdgeBinder\Registry\AdapterRegistry;
// Check what's available
if (AdapterRegistry::hasAdapter('inmemory')) {
$types = AdapterRegistry::getRegisteredTypes(); // ['inmemory', 'weaviate', ...]
$factory = AdapterRegistry::getFactory('inmemory');
}
// Clean management
AdapterRegistry::unregister('old-adapter');
AdapterRegistry::clear(); // Perfect for test cleanup🔧 Technical Improvements
Architecture Enhancements
- Interface-based design - EdgeBinder supports extension and decoration patterns
- Registry introspection - Full visibility into registered adapters
- Static analysis compatibility - Resolved PHPStan and CS-Fixer conflicts
Code Quality
- PHPStan Level 8 - Maintains strict static analysis with 0 errors
- CS-Fixer compatibility - Clean code formatting without conflicts
- Enhanced test coverage - 252 tests with 712 assertions (up from 246 tests)
Performance Improvements
- Unit tests: 10-100x faster execution with InMemoryEdgeBinder
- No I/O operations: Pure in-memory testing without external dependencies
- Isolated environments: Each test gets fresh, isolated EdgeBinder instance
📊 Statistics
Test Coverage
- 252 tests passing (up from 246)
- 712 assertions (up from 694)
- 24 new testing utility tests
- 6 additional registry management tests
- 4 new version compatibility tests
New Components
src/Testing/InMemoryEdgeBinder.php- Fast in-memory implementationsrc/Testing/EdgeBinderTestFactory.php- Test utility factorytests/Unit/Testing/- Complete test coverage for testing utilities- Enhanced
src/Registry/AdapterRegistry.phpwith 5 new methods
🌟 Framework Integration
Laravel
// AppServiceProvider.php
$this->app->bind(EdgeBinderInterface::class, EdgeBinder::class);
// For testing
$this->app->bind(EdgeBinderInterface::class, InMemoryEdgeBinder::class);Symfony
# config/services.yaml
services:
EdgeBinder\Contracts\EdgeBinderInterface:
alias: EdgeBinder\EdgeBinder
# For testing
EdgeBinder\Testing\InMemoryEdgeBinder: ~Generic PHP
// PSR-11 Container
$container->set(EdgeBinderInterface::class, EdgeBinder::class);
// Testing setup
$container->set(EdgeBinderInterface::class, InMemoryEdgeBinder::class);🔄 Migration Guide
From v0.3.0 to v0.4.0
No Breaking Changes - This release is fully backward compatible.
Recommended Updates:
- Use Interface in Dependencies:
// Old (still works)
class MyService {
public function __construct(EdgeBinder $edgeBinder) {}
}
// New (recommended)
class MyService {
public function __construct(EdgeBinderInterface $edgeBinder) {}
}- Upgrade Your Tests:
// Old (slow integration test)
$adapter = new InMemoryAdapter();
$edgeBinder = new EdgeBinder($adapter);
// New (fast unit test)
$edgeBinder = EdgeBinderTestFactory::createInMemory();
// or
$edgeBinder = new InMemoryEdgeBinder();- Use Enhanced Registry:
// Check what's registered
$availableTypes = AdapterRegistry::getRegisteredTypes();
// Clean up in tests
AdapterRegistry::clear();🎁 Benefits for Developers
Testing Revolution
- Instant feedback: Tests run in milliseconds instead of seconds
- No setup required: No need to configure external storage systems
- Isolated tests: Each test gets a fresh, clean environment
- Easy assertions: Built-in helper methods for common test scenarios
Architecture Flexibility
- Dependency injection: Full support for all DI containers
- Decorator pattern: Easy to add logging, caching, monitoring
- Framework agnostic: Works with any PHP framework
- Custom implementations: Build specialized EdgeBinder variants
Development Workflow
- TDD friendly: Fast tests enable true test-driven development
- Better debugging: VERSION constant and enhanced error messages
- IDE support: Full autocomplete and type checking
- Clean code: Interface-based design promotes SOLID principles
📦 Installation
composer require edgebinder/edgebinder:^0.4.0🔗 Useful Links
- Documentation: README.md
- Changelog: CHANGELOG.md
- Testing Guide: tests/README.md
- Issues: GitHub Issues
🙏 Contributors
This release represents a significant milestone in EdgeBinder's evolution:
- Implemented comprehensive interface enhancement proposal
- Added complete testing infrastructure with utilities
- Merged auto-registration enhancements seamlessly
- Resolved static analysis tool conflicts
- Enhanced developer experience across all use cases
- Maintained 100% backward compatibility throughout
Full Changelog: v0.3.0...v0.4.0
Previous Release: v0.3.0