PHPackages                             sweetchuck/cdd - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sweetchuck/cdd

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sweetchuck/cdd
==============

Circular dependency detector

v2.0.0(8mo ago)0276.1k↓48.6%[1 issues](https://github.com/Sweetchuck/cdd/issues)1GPL-3.0-or-laterPHPPHP &gt;=8.2CI failing

Since Nov 30Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Sweetchuck/cdd)[ Packagist](https://packagist.org/packages/sweetchuck/cdd)[ RSS](/packages/sweetchuck-cdd/feed)WikiDiscussions 2.x Synced yesterday

READMEChangelog (4)Dependencies (14)Versions (8)Used By (1)

Circular dependency detector
============================

[](#circular-dependency-detector)

[![CircleCI](https://camo.githubusercontent.com/8398a0103be07f008c7c39d3d475a7f793fa98e085b36c6205e169e9f9d83ac2/68747470733a2f2f636972636c6563692e636f6d2f67682f5377656574636875636b2f6364642f747265652f322e782e7376673f7374796c653d737667)](https://circleci.com/gh/Sweetchuck/cdd/?branch=2.x)[![codecov](https://camo.githubusercontent.com/1899e42a719a65d05d92d222c8c93832ca5c79b52fd080cfdc29e70a7d514b0c/68747470733a2f2f636f6465636f762e696f2f67682f5377656574636875636b2f6364642f6272616e63682f322e782f67726170682f62616467652e7376673f746f6b656e3d48534631364f47507972)](https://app.codecov.io/gh/Sweetchuck/cdd/branch/2.x)

A lightweight PHP library for detecting circular dependencies in complex systems. This library provides a simple and efficient API to identify loops and cycles within dependency chains, making it an essential tool for maintaining clean architecture and preventing infinite loops in your applications.

When to Use
-----------

[](#when-to-use)

This library is ideal for projects that need to:

- **Validate dependency graphs** - Ensure there are no circular references in your dependency structures
- **Build system management** - Detect cycles in build task dependencies to prevent infinite loops
- **Module/package validation** - Verify that plugin systems or modular architectures don't have circular imports
- **Code analysis tools** - Power dependency analysis features in linters and static analysis tools
- **Architecture enforcement** - Maintain strict layered architecture by preventing unwanted circular dependencies
- **Plugin systems** - Validate plugin dependencies before loading them

Features
--------

[](#features)

- Zero runtime dependencies - lightweight and dependency-free
- Detects complex cycles - identifies loops of any depth
- Returns cycle paths - shows exactly which items form the cycle

Usage
-----

[](#usage)

```
