Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Tree View Laravel Package

openplain/filament-tree-view

Drag-and-drop tree view for Filament resources to manage hierarchical data. Built on Laravel Adjacency List and Atlassian Pragmatic Drag & Drop. Supports depth limits, auto or batch save, custom fields, actions, dark mode, accessibility, and safe moves.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Hierarchical Data Management: Perfect fit for systems requiring nested structures (e.g., categories, org charts, file systems). Leverages Laravel’s adjacency list pattern via staudenmeir/laravel-adjacency-list, a battle-tested approach.
  • Filament Integration: Designed as a drop-in replacement for Filament’s Table, maintaining consistency with Filament’s API (e.g., tree(), fields(), actions()). Aligns with Filament’s component-based architecture.
  • Separation of Concerns: Decouples tree logic from business models via traits (HasTreeStructure) and resource-specific configurations, enabling reuse across projects.
  • Extensibility: Supports custom fields, actions, and query modifications, allowing adaptation to domain-specific needs (e.g., custom validation, bulk operations).

Integration Feasibility

  • Low Friction: Minimal setup (trait + resource method) with zero breaking changes to existing Filament resources. Compatible with Filament 4/5 and Laravel 11/12.
  • Database Agnostic: Works with any Eloquent model, though requires parent_id and order columns (or customizable column names). No schema migrations provided—assumes existing tree structure or willingness to adapt.
  • Asset Management: Automatically registers CSS/JS via filament:assets, reducing manual configuration.
  • Dependency Risks: Relies on laravel-adjacency-list (proven) and pragmatic-drag-and-drop (Atlassian-backed). No heavyweight dependencies.

Technical Risk

  • Performance at Scale:
    • Drag-and-Drop: Client-side reordering may lag with >1,000 nodes due to DOM complexity. Mitigated by maxDepth() and lazy-loading (not explicitly documented but implied).
    • Query Depth: Recursive queries (e.g., descendants()) can hit database limits. Risk mitigated by maxDepth() and Laravel’s query caching.
    • Auto-Save: Enabled by default, which may overwhelm APIs with frequent writes. Recommend manual save mode for high-traffic systems.
  • Edge Cases:
    • Circular References: Prevented by design, but custom validation may be needed for complex business rules.
    • Concurrency: No built-in optimistic locking for drag-and-drop conflicts. Requires application-level handling (e.g., retries, user notifications).
  • Testing: Limited public test coverage (no visible test suite in repo). Assumes reliability via dependency libraries.
  • Future-Proofing: Active maintenance (last release 2026-05-07), but no roadmap. Risk of stagnation if Filament core evolves significantly.

Key Questions

  1. Data Volume:
    • How many nodes will the tree typically display? If >1,000, consider pagination or virtual scrolling (not natively supported).
  2. Concurrency:
    • Will multiple users edit the tree simultaneously? If yes, plan for conflict resolution (e.g., UI feedback, server-side validation).
  3. Custom Logic:
    • Are there business rules beyond drag-and-drop (e.g., permissions, audit logs)? The package lacks hooks for pre/post-reorder events.
  4. Legacy Systems:
    • Does the database use non-standard column names for parent_id/order? Customize via getParentKeyName() and getOrderKeyName().
  5. Accessibility:
    • Are keyboard navigation and screen reader support tested for your use case? The package claims compliance but may need UX validation.
  6. Deployment:
    • Will the tree be used in a headless or SPAs context? The package assumes Filament’s traditional server-rendered workflow.

Integration Approach

Stack Fit

  • Laravel/PHP: Native support for Eloquent models and Filament’s resource system. No framework-specific quirks.
  • Filament Ecosystem: Seamless integration with Filament’s:
    • Resources: Replaces table() with tree() in resource classes.
    • Pages: Provides TreePage and TreeRelationPage for dedicated tree views.
    • Actions: Supports Filament’s action system (e.g., EditAction, DeleteAction).
  • Frontend: Uses Pragmatic Drag & Drop (Atlassian’s library), ensuring accessibility and performance. No custom JS required beyond Filament’s asset pipeline.
  • Database: Requires adjacency list structure (parent_id, order). Works with:
    • MySQL/PostgreSQL (default).
    • SQLite (untested but likely compatible).
    • Avoids nested sets or materialized paths, which may be needed for complex queries.

Migration Path

  1. Assess Existing Hierarchies:
    • Audit current tree structures (e.g., categories, menus) to confirm compatibility with adjacency lists.
    • Example: Convert nested sets to adjacency lists if needed:
      // Pseudocode for migration
      $nodes = Node::with('children')->get();
      foreach ($nodes as $node) {
          $node->parent_id = $node->parent?->id;
          $node->order = $node->depth; // Or custom logic
          $node->save();
      }
      
  2. Model Adaptation:
    • Add HasTreeStructure trait to models (e.g., Category, Product).
    • Customize column names if using non-standard schemas:
      public function getParentKeyName(): string { return 'parent_node_id'; }
      
  3. Resource Refactoring:
    • Replace table() with tree() in Filament resources.
    • Migrate from ListRecords to TreePage or TreeRelationPage.
    • Example:
      // Before
      public static function table(Table $table): Table { ... }
      
      // After
      public static function tree(Tree $tree): Tree {
          return $tree->fields([TextField::make('name')]);
      }
      
  4. Testing:
    • Validate drag-and-drop reordering with edge cases (e.g., root nodes, deep nesting).
    • Test actions (edit/delete) and save modes (auto/manual).

Compatibility

  • Filament Versions: Officially supports 4.x/5.x. Test thoroughly if using beta releases.
  • Laravel Versions: PHP 8.2+ and Laravel 11/12. Avoid older versions due to dependency constraints.
  • Third-Party Packages:
    • spatie/laravel-filament-resource-panels: Confirmed compatible (used in examples).
    • filament/spatie-laravel-medialibrary: Untested but likely compatible for file hierarchies.
  • Custom Fields: Supports Filament’s field API (e.g., TextField, IconField). Extend via Fields\Field for domain-specific fields.

Sequencing

  1. Phase 1: Proof of Concept
    • Implement a single resource (e.g., Category) with basic tree functionality.
    • Test drag-and-drop, save modes, and actions.
  2. Phase 2: Core Integration
    • Replace all Filament tables with trees for hierarchical data.
    • Customize fields/actions per resource.
  3. Phase 3: Optimization
    • Adjust maxDepth() and collapsible() for performance.
    • Implement custom validation or hooks if needed.
  4. Phase 4: Rollout
    • Deploy to staging with monitoring for:
      • Database query performance.
      • Client-side rendering lag.
      • User feedback on UX.

Operational Impact

Maintenance

  • Dependencies:
    • Pros: Minimal (core Filament + 2 libraries). Easy to update via Composer.
    • Cons: No built-in dependency management (e.g., auto-updates). Monitor laravel-adjacency-list for breaking changes.
  • Configuration:
    • Centralized: Tree logic lives in resource classes (e.g., tree() method). Changes require code deployments.
    • No Runtime Config: Unlike some packages, no .env or runtime toggles.
  • Documentation:
    • Strengths: Clear README with examples, changelog, and release notes.
    • Gaps: Lacks advanced topics (e.g., custom queries, performance tuning). Assume "Filament Table" knowledge.

Support

  • Community:
    • Stars: 38 (modest but not concerning for niche use cases).
    • Dependents: 0 (early-stage adoption). Risk of unanswered issues.
    • GitHub Issues: Check for open/closed issues (e.g., drag-and-drop bugs, edge cases).
  • Vendor Lock-in:
    • Low: Uses standard Filament/Laravel patterns. Migrating away would require rewriting tree logic.
  • Error Handling:
    • Client-Side: Drag-and-drop provides visual feedback (e.g., invalid moves).
    • Server-Side: Silent failures possible (e.g., database constraints). Recommend:
      // Example: Add validation to tree actions
      Tree::make()->actions([
          Action::make('reorder')
              ->requiresConfirmation()
              ->action(function (array $data) {
                  // Custom validation logic
                  if (invalid
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle