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

Topsort Laravel Package

marcj/topsort

Fast PHP topological sort/dependency resolver. Add string nodes with dependencies and get a valid processing order; includes grouped sorting to keep same-type items together and retrieve group metadata. Useful for UoW, DI, package managers, etc.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Dependency Resolution for Complex Systems: Accelerate development of systems requiring strict dependency ordering (e.g., task queues, build pipelines, or microservices orchestration) by reducing manual dependency management.
  • Performance-Critical Paths: Justify adoption for high-throughput systems (e.g., real-time data pipelines, CI/CD workflows) where topological sorting is a bottleneck, leveraging its 20x speed improvement over traditional implementations.
  • Build vs. Buy: Replace custom dependency resolution logic (e.g., in legacy systems) or avoid reinventing the wheel for dependency graphs (e.g., in package managers or DI containers).
  • Roadmap for Scalability: Enable future-proofing for modular architectures (e.g., plugin systems, dynamic feature flags) where dependencies must resolve dynamically at runtime.
  • Data Pipeline Optimization: Use cases like Unit of Work patterns (e.g., ORM operations, batch processing) or graph-based workflows (e.g., DAG execution) where grouped topological sorting reduces complexity.

When to Consider This Package

  • Adopt When:

    • Your system requires high-performance dependency resolution (e.g., >10K nodes) and traditional implementations (e.g., array-based) are too slow.
    • You need grouped topological sorting (e.g., batching related operations like database transactions or API calls).
    • Dependencies are dynamic or runtime-generated (e.g., plugin systems, A/B testing feature toggles).
    • You’re building a package manager, DI container, or build tool where dependency cycles must be detected and resolved efficiently.
    • Your team lacks expertise in custom graph algorithms but needs reliable topological sorting.
  • Look Elsewhere When:

    • Dependencies are static and trivial (e.g., simple config files) where a manual order or basic ksort() suffices.
    • You need real-time cycle detection (this package throws exceptions on cycles; consider league/graph for interactive debugging).
    • Your stack is non-PHP (e.g., Python/Go/JavaScript ecosystems have optimized alternatives like networkx or dagre).
    • You require visualization or interactive tools for dependency graphs (e.g., Mermaid.js integrations).
    • The package’s last release (2020) is a blocker for your long-term roadmap (though MIT license allows forks/maintenance).

How to Pitch It (Stakeholders)

For Executives: *"This lightweight PHP package solves a hidden technical debt problem: dependency resolution bottlenecks. By adopting topsort, we can:

  • Cut dependency resolution time by 20x, accelerating critical paths like build pipelines or real-time workflows.
  • Reduce bugs from manual ordering by automating topological sorting for complex systems (e.g., microservices, plugins).
  • Future-proof modular architectures (e.g., feature flags, dynamic loading) without reinventing the wheel. It’s a low-risk, high-reward choice—MIT-licensed, battle-tested, and used in niche but high-impact scenarios like package managers. Let’s pilot it in [X system] to quantify the performance lift."*

For Engineers: *"This is a drop-in replacement for any custom dependency sorting logic in PHP. Key wins:

  • Blazing fast: Uses strings instead of arrays, avoiding the overhead of traditional implementations.
  • Flexible: Supports both plain topological sorts (e.g., for task queues) and grouped sorts (e.g., batching related DB operations).
  • Simple API: Just add() nodes/dependencies and sort()—no complex setup.
  • Proven: Used in DI containers and package managers (e.g., Composer-like tools). Tradeoff: Last updated in 2020, but the core algorithm is stable. We can fork it if needed for maintenance. Proposal: Let’s use it for [Y use case] and compare performance against our current solution."*
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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle