{"id":23024654,"url":"https://github.com/previousnext/nested-set","last_synced_at":"2025-06-13T19:05:03.139Z","repository":{"id":13373272,"uuid":"74253853","full_name":"previousnext/nested-set","owner":"previousnext","description":"PHP Nested Set with Doctrine DBAL storage.","archived":false,"fork":false,"pushed_at":"2023-05-03T12:26:00.000Z","size":124,"stargazers_count":15,"open_issues_count":8,"forks_count":8,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-06-13T19:04:05.787Z","etag":null,"topics":["php-lib"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/previousnext.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-20T04:59:24.000Z","updated_at":"2024-11-11T01:42:08.000Z","dependencies_parsed_at":"2024-06-19T09:54:52.795Z","dependency_job_id":"3f76cdfc-7d1b-4979-b55e-1dc4139aaa7b","html_url":"https://github.com/previousnext/nested-set","commit_stats":{"total_commits":58,"total_committers":6,"mean_commits":9.666666666666666,"dds":0.3620689655172413,"last_synced_commit":"40d9f21afa6b5ef82fab4f7810fae5ee4ef9adfa"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/previousnext/nested-set","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/previousnext%2Fnested-set","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/previousnext%2Fnested-set/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/previousnext%2Fnested-set/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/previousnext%2Fnested-set/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/previousnext","download_url":"https://codeload.github.com/previousnext/nested-set/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/previousnext%2Fnested-set/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259704393,"owners_count":22898857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php-lib"],"created_at":"2024-12-15T13:20:27.203Z","updated_at":"2025-06-13T19:05:02.726Z","avatar_url":"https://github.com/previousnext.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nested Set\n\nA PHP Doctrine DBAL implementation for Nested Sets.\n\n[![CircleCI](https://circleci.com/gh/previousnext/nested-set.svg?style=svg)](https://circleci.com/gh/previousnext/nested-set)\n\n## Using\n\n### Create table schema\n\nCreate the table schema, passing in a a [DBAL connection](http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#getting-a-connection) and table name (defaults to 'tree').\n```php\n$schema = new DbalNestedSetSchema($connection, 'my_tree');\nschema-\u003ecreate();\n```\n\n### Set up the nested set client\n\nCreate a new `DbalNestedSet` passing in the DBAL connection and the table name.\n\n```php\n$nestedSet = new DbalNestedSet($connection, 'my_tree');\n```\n\n### Add a root node\n\nA NodeKey represents a unique ID for a node in the tree. It supports the idea of a node ID and a revision ID, mostly for compatibility with Drupal.\n\n```php\n$nodeKey = new NodeKey($id, $revisionId);\n$rootNode = $nestedSet-\u003eaddRootNode($nodeKey);\n```\n\n### Add a child node\n\nTo add a child node, you provide the parent node, and a child node key.\n\n```php\n$nodeKey = new NodeKey($id, $revisionId);\n$nestedSet-\u003eaddNodeBelow($rootNode, $nodeKey);\n```\n\n### Find Descendants\n\nTo find descendents, you provide the parent node key.\n\n```php\n$nodeKey = new NodeKey($id, $revisionId);\n$descendants = $this-\u003enestedSet-\u003efindDescendants($nodeKey);\n```\n\n### Find ancestors\n\nTo find ancestors, you provide the child node key.\n\n```php\n$nodeKey = new NodeKey($id, $revisionId);\n$ancestors = $this-\u003enestedSet-\u003efindAncestors($nodeKey);\n```\n\nSee `\\PNX\\NestedSet\\NestedSetInterface` for many more methods that can be used for interacting with the nested set.\n\n## Developing\n\n### Dependencies\n\nTo install all dependencies, run:\n\n```\nmake init\n```\n\n### Linting\n\nUses the Drupal coding standard.\n\nTo validate code sniffs run: \n\n```\nmake lint-php\n```\n\nTo automatically fix code sniff issues, run:\n\n```\nmake fix-php\n```\n\n\n### Testing\n\nTo run all phpunit tests, run:\n\n```\nmake test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreviousnext%2Fnested-set","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpreviousnext%2Fnested-set","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreviousnext%2Fnested-set/lists"}