https://github.com/antalaron/circular-reference-detect
PHP library to detect reference circular references in array
https://github.com/antalaron/circular-reference-detect
circular-reference library php
Last synced: 3 months ago
JSON representation
PHP library to detect reference circular references in array
- Host: GitHub
- URL: https://github.com/antalaron/circular-reference-detect
- Owner: antalaron
- License: mit
- Created: 2017-04-04T15:46:26.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-17T10:52:27.000Z (almost 9 years ago)
- Last Synced: 2025-08-30T18:27:21.244Z (8 months ago)
- Topics: circular-reference, library, php
- Language: PHP
- Size: 11.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Circular reference detect
=========================
[](https://travis-ci.org/antalaron/circular-reference-detect) [](https://coveralls.io/github/antalaron/circular-reference-detect?branch=master) [](https://packagist.org/packages/antalaron/circular-reference-detect) [](https://packagist.org/packages/antalaron/circular-reference-detect) [](https://packagist.org/packages/antalaron/circular-reference-detect)
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:
```bash
$ composer require antalaron/circular-reference-detect
```
This command requires you to have Composer installed globally, as explained
in the [installation chapter](https://getcomposer.org/doc/00-intro.md)
of the Composer documentation.
Usage
-----
Find a circular reference in an array:
```php
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](docs/01-installation.md)
2. [Usage](docs/02-usage.md)
3. [Contributing](docs/03-contributing.md)
License
-------
This library is under [MIT License](http://opensource.org/licenses/mit-license.php).