Skip to content

Releases: aliziodev/laravel-taxonomy

v2.4.3

03 Jul 23:21

Choose a tag to compare

2.4.3 (2025-07-03)

Bug Fixes

  • ci: install orchestra/testbench as dev dependency in all workflows (4c52711)

v2.4.2

03 Jul 23:06

Choose a tag to compare

2.4.2 (2025-07-03)

Bug Fixes

  • composer: move orchestra/testbench to require-dev section (dc5a1a7)

v2.4.1

03 Jul 23:01

Choose a tag to compare

2.4.1 (2025-07-03)

Bug Fixes

  • taxonomy: include type in DuplicateSlugException for better error context (67cdd43)

v2.4.0

03 Jul 22:57

Choose a tag to compare

2.4.0 (2025-07-03)

Bug Fixes

  • Taxonomy: include type in DuplicateSlugException for better error context (6665b4e)

Features

  • exceptions: add type context to DuplicateSlugException for better debugging (defd29b)

v2.3.0

03 Jul 21:19

Choose a tag to compare

2.3.0 (2025-07-03)

⚠ BREAKING CHANGES

  • Composite Unique Slugs: Implementation of composite unique slug system for taxonomies that changes how slug uniqueness is handled. Previously slugs only needed to be globally unique, now uniqueness is determined by the combination of slug, type, and parent_id. This change requires database migration and may affect code that relies on global slug uniqueness assumptions.

Features

  • Composite Unique Slugs for Taxonomies (c7c6d58)
    • Added composite unique constraint on slug, type, and parent_id columns
    • Allows same slug for different taxonomy types or different parents
    • Improves flexibility in taxonomy hierarchy management
    • Provides automatic migration to update database structure
    • Adds validation to prevent slug duplication within the same context

Migration Guide

To upgrade from v2.2.1 to v2.3.0:

  1. Backup Database: Ensure you backup your database before upgrading
  2. Update Package: Run composer update aliziodev/laravel-taxonomy
  3. Create Migration: Generate migration file for database schema changes
  4. Handle Conflicts: Check and resolve any existing slug conflicts across different types
  5. Run Migration: Execute the migration to update database constraints
  6. Review Code: Update any code that relies on global slug uniqueness
  7. Test Thoroughly: Perform comprehensive testing on taxonomy features

Technical Details

This change affects:

  • Database Schema: Addition of composite unique constraint
  • Model Validation: Updated validation rules for slugs
  • Query Logic: Adjustments to queries that depend on slug uniqueness
  • API Behavior: Changes in API behavior for handling duplicate slugs

For complete upgrade information, please refer to the UPGRADE.md file.

v2.2.1

02 Jul 18:28

Choose a tag to compare

Bug Fixes

v2.2.0

17 Jun 23:33

Choose a tag to compare

2.2.0 (2025-06-17)

Features

  • HasTaxonomy: add taxonomy scopes for filtering models (5cc5a78)
  • Taxonomy: add getSiblings method to retrieve same-level taxonomies (4756c1a)

v2.1.0

17 Jun 14:28

Choose a tag to compare

2.1.0 (2025-06-17)

Features

  • implement automated changelog system (0c8c6c0)

v2.0.2

17 Jun 13:02

Choose a tag to compare

🚀 Major Features Added

Nested Set Model Implementation

  • Added complete Nested Set Model support for hierarchical data management
  • Implemented automatic left/right boundary calculation (lft, rgt, depth fields)
  • Added efficient tree traversal methods for ancestors, descendants, and siblings
  • Integrated automatic nested set maintenance on create, update, and delete operations

Performance Optimizations

  • Added bulk operations support for large-scale taxonomy management
  • Implemented efficient tree rebuilding with rebuildNestedSet() method
  • Added performance monitoring and benchmarking capabilities
  • Optimized database queries using nested set boundaries instead of recursive queries

Advanced Tree Operations

  • Added moveToParent() method for efficient node repositioning
  • Implemented cascade delete with orphan prevention
  • Added tree validation and integrity checking
  • Support for concurrent operations with race condition handling

Console Commands

  • Added taxonomy:rebuild-nested-set command for rebuilding nested set values
  • Enhanced taxonomy:install command with better error handling

🔧 Technical Improvements

Database Schema Enhancements

-- Added nested set fields to taxonomies table
ALTER TABLE taxonomies ADD COLUMN lft INTEGER;
ALTER TABLE taxonomies ADD COLUMN rgt INTEGER;
ALTER TABLE taxonomies ADD COLUMN depth INTEGER DEFAULT 0;

-- Added indexes for performance
CREATE INDEX idx_taxonomies_nested_set ON taxonomies(type, lft, rgt);
CREATE INDEX idx_taxonomies_parent ON taxonomies(parent_id);

Model Enhancements

  • Enhanced Taxonomy model with nested set methods:
    • getAncestors() - Get all parent nodes
    • getDescendants() - Get all child nodes
    • getSiblings() - Get nodes at same level
    • getNestedTree() - Get complete tree structure
    • isAncestorOf() - Check parent-child relationship
    • isDescendantOf() - Check child-parent relationship

Service Layer Improvements

  • Added TaxonomyManager service for complex operations
  • Implemented transaction-safe operations for data integrity
  • Added batch processing capabilities for large datasets
  • Enhanced error handling with custom exceptions

🧪 Testing Infrastructure

Comprehensive Test Suite

  • Added ExtremeTaxonomyTest for edge cases and large datasets
  • Added TaxonomyPerformanceTest for performance benchmarking
  • Added TaxonomyConcurrencyTest for race condition testing
  • Added NestedSetTest for nested set specific operations

Performance Test Coverage

  • Move operation efficiency testing with time assertions
  • Descendants retrieval performance for various tree sizes
  • Delete operations with cascade and orphan prevention
  • Memory usage monitoring for large operations
  • Concurrent operation handling with database transactions

📊 Performance Metrics

Before Nested Set (v1.x)

  • Tree traversal: O(n) recursive queries
  • Ancestor retrieval: Multiple database hits
  • Move operations: Expensive parent_id updates
  • Large trees: Performance degradation

After Nested Set (v2.0)

  • Tree traversal: O(1) single query with boundaries
  • Ancestor retrieval: Single query with lft/rgt comparison
  • Move operations: Efficient boundary recalculation
  • Large trees: Consistent performance up to 10,000+ nodes

🔄 Migration Guide

Database Migration

# Run the migration to add nested set fields
php artisan migrate

# Rebuild nested set values for existing data
php artisan taxonomy:rebuild-nested-set

# Rebuild specific taxonomy type
php artisan taxonomy:rebuild-nested-set category

# Force rebuild without confirmation
php artisan taxonomy:rebuild-nested-set --force

Code Updates

// Old way (v1.x)
$children = $taxonomy->children;
$ancestors = $this->getAncestorsRecursively($taxonomy);

// New way (v2.0)
$children = $taxonomy->getDescendants();
$ancestors = $taxonomy->getAncestors();

⚠️ Breaking Changes

  • Database schema changes require migration
  • Some method signatures changed for consistency
  • Performance test thresholds may need adjustment for different environments
  • Soft delete behavior modified for nested set integrity

🐛 Bug Fixes

  • Fixed race conditions in concurrent move operations
  • Resolved orphan node issues in delete operations
  • Fixed nested set boundary corruption in edge cases
  • Corrected performance test assertions for realistic expectations

📚 Documentation

  • Added comprehensive API documentation for all nested set methods
  • Created performance benchmarking guide with optimization tips
  • Added migration guide for upgrading from v1.x
  • Enhanced README with nested set usage examples

v2.0.1

31 May 16:02

Choose a tag to compare

🚀 Major Features Added

Nested Set Model Implementation

  • Added complete Nested Set Model support for hierarchical data management
  • Implemented automatic left/right boundary calculation (lft, rgt, depth fields)
  • Added efficient tree traversal methods for ancestors, descendants, and siblings
  • Integrated automatic nested set maintenance on create, update, and delete operations

Performance Optimizations

  • Added bulk operations support for large-scale taxonomy management
  • Implemented efficient tree rebuilding with rebuildNestedSet() method
  • Added performance monitoring and benchmarking capabilities
  • Optimized database queries using nested set boundaries instead of recursive queries

Advanced Tree Operations

  • Added moveToParent() method for efficient node repositioning
  • Implemented cascade delete with orphan prevention
  • Added tree validation and integrity checking
  • Support for concurrent operations with race condition handling

Console Commands

  • Added taxonomy:rebuild-nested-set command for rebuilding nested set values
  • Enhanced taxonomy:install command with better error handling

🔧 Technical Improvements

Database Schema Enhancements

-- Added nested set fields to taxonomies table
ALTER TABLE taxonomies ADD COLUMN lft INTEGER;
ALTER TABLE taxonomies ADD COLUMN rgt INTEGER;
ALTER TABLE taxonomies ADD COLUMN depth INTEGER DEFAULT 0;

-- Added indexes for performance
CREATE INDEX idx_taxonomies_nested_set ON taxonomies(type, lft, rgt);
CREATE INDEX idx_taxonomies_parent ON taxonomies(parent_id);

Model Enhancements

  • Enhanced Taxonomy model with nested set methods:
    • getAncestors() - Get all parent nodes
    • getDescendants() - Get all child nodes
    • getSiblings() - Get nodes at same level
    • getNestedTree() - Get complete tree structure
    • isAncestorOf() - Check parent-child relationship
    • isDescendantOf() - Check child-parent relationship

Service Layer Improvements

  • Added TaxonomyManager service for complex operations
  • Implemented transaction-safe operations for data integrity
  • Added batch processing capabilities for large datasets
  • Enhanced error handling with custom exceptions

🧪 Testing Infrastructure

Comprehensive Test Suite

  • Added ExtremeTaxonomyTest for edge cases and large datasets
  • Added TaxonomyPerformanceTest for performance benchmarking
  • Added TaxonomyConcurrencyTest for race condition testing
  • Added NestedSetTest for nested set specific operations

Performance Test Coverage

  • Move operation efficiency testing with time assertions
  • Descendants retrieval performance for various tree sizes
  • Delete operations with cascade and orphan prevention
  • Memory usage monitoring for large operations
  • Concurrent operation handling with database transactions

📊 Performance Metrics

Before Nested Set (v1.x)

  • Tree traversal: O(n) recursive queries
  • Ancestor retrieval: Multiple database hits
  • Move operations: Expensive parent_id updates
  • Large trees: Performance degradation

After Nested Set (v2.0)

  • Tree traversal: O(1) single query with boundaries
  • Ancestor retrieval: Single query with lft/rgt comparison
  • Move operations: Efficient boundary recalculation
  • Large trees: Consistent performance up to 10,000+ nodes

🔄 Migration Guide

Database Migration

# Run the migration to add nested set fields
php artisan migrate

# Rebuild nested set values for existing data
php artisan taxonomy:rebuild-nested-set

# Rebuild specific taxonomy type
php artisan taxonomy:rebuild-nested-set category

# Force rebuild without confirmation
php artisan taxonomy:rebuild-nested-set --force

Code Updates

// Old way (v1.x)
$children = $taxonomy->children;
$ancestors = $this->getAncestorsRecursively($taxonomy);

// New way (v2.0)
$children = $taxonomy->getDescendants();
$ancestors = $taxonomy->getAncestors();

⚠️ Breaking Changes

  • Database schema changes require migration
  • Some method signatures changed for consistency
  • Performance test thresholds may need adjustment for different environments
  • Soft delete behavior modified for nested set integrity

🐛 Bug Fixes

  • Fixed race conditions in concurrent move operations
  • Resolved orphan node issues in delete operations
  • Fixed nested set boundary corruption in edge cases
  • Corrected performance test assertions for realistic expectations

📚 Documentation

  • Added comprehensive API documentation for all nested set methods
  • Created performance benchmarking guide with optimization tips
  • Added migration guide for upgrading from v1.x
  • Enhanced README with nested set usage examples