antalaron/circular-reference-detect

Circular reference detector

v1.0.1 2017-07-17 10:45 UTC

This package is auto-updated.

Last update: 2024-03-16 18:19:40 UTC


README

Build Status Coverage Status Latest Stable Version Latest Unstable Version License

PHP library to detect reference circular references in array.

Installation

Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:

$ composer require antalaron/circular-reference-detect

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Usage

Find a circular reference in an array:

require __DIR__.'/vendor/autoload.php';

use Antalaron\Component\CircularReferenceDetect\CircularReferenceDetect;
$a = [
    'a' => ['b'],
    'b' => ['c'],
    'c' => ['a'],
];
$detector = new CircularReferenceDetect();
$detector->hasCircularReference($a);

Documentation

  1. Installation
  2. Usage
  3. Contributing

License

This library is under MIT License.