PHPackages                             codeaxion/nestifyx - 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. codeaxion/nestifyx

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

codeaxion/nestifyx
==================

The NestifyX package provides functionality for managing categories or nested elements within your application.

v1.0.0(2y ago)184MITPHP

Since Feb 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/CODE-AXION/NestifyX)[ Packagist](https://packagist.org/packages/codeaxion/nestifyx)[ RSS](/packages/codeaxion-nestifyx/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

NestifyX Laravel Package
========================

[](#nestifyx-laravel-package)

 [![](https://private-user-images.githubusercontent.com/97381867/307115733-13f078a2-a179-4b06-8a2b-813a2490fcec.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU3MzY0MTEsIm5iZiI6MTc3NTczNjExMSwicGF0aCI6Ii85NzM4MTg2Ny8zMDcxMTU3MzMtMTNmMDc4YTItYTE3OS00YjA2LThhMmItODEzYTI0OTBmY2VjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDA5VDEyMDE1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA0MGIwNTBlNTk3YWIzZjcwYmMwN2I5ZmI0YzdjZmRlZGNlOWI2NjQyNjJlNjlkYzc2ZmQ1YzA0OGFmNTgxMDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.01peI4K5diCdQyWYP4Ce2mndbsMJ2YBGeV5iIbW2Q6Q)](https://private-user-images.githubusercontent.com/97381867/307115733-13f078a2-a179-4b06-8a2b-813a2490fcec.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU3MzY0MTEsIm5iZiI6MTc3NTczNjExMSwicGF0aCI6Ii85NzM4MTg2Ny8zMDcxMTU3MzMtMTNmMDc4YTItYTE3OS00YjA2LThhMmItODEzYTI0OTBmY2VjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDA5VDEyMDE1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA0MGIwNTBlNTk3YWIzZjcwYmMwN2I5ZmI0YzdjZmRlZGNlOWI2NjQyNjJlNjlkYzc2ZmQ1YzA0OGFmNTgxMDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.01peI4K5diCdQyWYP4Ce2mndbsMJ2YBGeV5iIbW2Q6Q)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#--)

Overview
--------

[](#overview)

The NestifyX Laravel package provides features for managing categories and manipulate nested elements within your application using recursive methods.

> Organize Your Categories with Ease.

 [![](https://private-user-images.githubusercontent.com/97381867/307116691-c8e1f213-9b9f-4e8c-ad23-a88aadc204e8.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU3MzY0MTEsIm5iZiI6MTc3NTczNjExMSwicGF0aCI6Ii85NzM4MTg2Ny8zMDcxMTY2OTEtYzhlMWYyMTMtOWI5Zi00ZThjLWFkMjMtYTg4YWFkYzIwNGU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDA5VDEyMDE1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA1NDQ2YTE2ZmQ3M2VjM2YyNzNhMDVlNzg2ZTRjY2I4ZTM1YjY1ZDNjZTg3MmI3MGRkZGQ2ZTg2OTAxZGNkMjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.3k09MSaHYOQwzfZ1kTwEQ7R3IchS82L75aywalwwSkA)](https://private-user-images.githubusercontent.com/97381867/307116691-c8e1f213-9b9f-4e8c-ad23-a88aadc204e8.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU3MzY0MTEsIm5iZiI6MTc3NTczNjExMSwicGF0aCI6Ii85NzM4MTg2Ny8zMDcxMTY2OTEtYzhlMWYyMTMtOWI5Zi00ZThjLWFkMjMtYTg4YWFkYzIwNGU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDA5VDEyMDE1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA1NDQ2YTE2ZmQ3M2VjM2YyNzNhMDVlNzg2ZTRjY2I4ZTM1YjY1ZDNjZTg3MmI3MGRkZGQ2ZTg2OTAxZGNkMjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.3k09MSaHYOQwzfZ1kTwEQ7R3IchS82L75aywalwwSkA)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#----)

Features
--------

[](#features)

1. **Category Tree Management:** This Module includes Category Management with the Ability of changing its position using drag and drop feature, you just have to include a button component and that's it .
2. **Recursion Methods:** This Module includes various methods to play with recursions, like generating tree, fetch Children/Parent ids, generate breadcrumbs, show tree view in dropdown etc...
3. **Performance:** Will do all your work in a single query.

#### Required Dependencies To Run Js Tree pop up

[](#required-dependencies-to-run-js-tree-pop-up)

> AlpineJs, Jquery, Jstree

[Demo Video](https://youtu.be/XwGvh_4aXvA)

Installation
------------

[](#installation)

To utilize the NestifyX package in your application, follow these steps:

1. **Installation**: Install the NestifyX package via Composer:

```
  composer require codeaxion/nestifyx
```

2. Add Your Required Dependencies via CDN (without these dependencies jstree wont work)

```
  //only optional if you have already have alpine js and tailwindcss package installed

  //jquery in header

  //jstree scripts and css (add styles in header and scripts in body)

```

3. Run necessary Migration

> Will add position column in your categories table for ordering

```
  php artisan migrate;
```

4. Integration: Include the Nestify Facade

```
  use CodeAxion\NestifyX\Facades\NestifyX;
```

Thats's it Your setup is over

Optional
--------

[](#optional)

5. (Optional) Publish config file if you have different table name

```
php artisan vendor:publish --provider="CodeAxion\NestifyX\NestifyXServiceProvider" --tag="config"

```

6. (Optional) Publish migration if you want

```
php artisan vendor:publish --provider="CodeAxion\NestifyX\NestifyXServiceProvider" --tag="migrations"

```

Usage
-----

[](#usage)

### Add Category Module Slider

[](#add-category-module-slider)

> After adding this blade component click on the button named category tree to open category module slider

```

```

#### Convert Normal Eloquent Collection/Array To Nested Tree

[](#convert-normal-eloquent-collectionarray-to-nested-tree)

```
 use CodeAxion\NestifyX\Facades\NestifyX;

 $categories = Category::orderByRaw('-position DESC')->get();

 $categories = NestifyX::nestTree($categories);
```

#### Sort Children without converting it to tree

[](#sort-children-without-converting-it-to-tree)

```
  use CodeAxion\NestifyX\Facades\NestifyX;

  $categories = Category::orderByRaw('-position DESC')->get(); //Sort by children with it's position (RECOMMENDED after sorting is done by jstree)
  //OR
  $categories = Category::get() //Sort by only children;

  //will return original database collection
  $categories = NestifyX::setIndent('|--')->sortChildren($categories); //fetch all categories and subcategories
  //OR
  $categories = NestifyX::setIndent('|--')->sortChildren($categories,5) //Pass different category id if you want their children of (refer to 2nd example)

  // In view
  @foreach($categories as $category)
   {{$category->indent}} {{$category->name}}
  @endforeach

  //Will result
  /**
  Electronics
  |-- Mobiles
  |-- |-- All Mobiles
  |-- Headphones
  |-- |-- All Headphones
  |-- Gaming
  |-- |-- Gaming Laptops
  |-- |-- Business Laptops
  |-- Laptops
  |-- |-- All Laptops
  |-- |-- Apple Laptops
  |-- |-- Microsoft Laptops
  */
```

#### Flatten Children (- useful for dropdowns)

[](#flatten-children---useful-for-dropdowns)

```
    use CodeAxion\NestifyX\Facades\NestifyX;

    $categories = \App\Models\Category::orderByRaw('-position DESC')->get();

    //fetch all categories and subcategories (CASE 1)
    $categories = NestifyX::setIndent('|--')->listsFlattened($categories);

    //OR
    //pass different category id if you want their children of (CASE 2)
    $categories = NestifyX::setIndent('|--')->listsFlattened($categories,5);
    //OR
    ////if your column name is different (default will be name)
    $categories = NestifyX::setIndent('|--')->setColumn('title')->listsFlattened($categories);

    dd($categories);

    //Result (CASE 1):
    /**
      #items: array:7 [▼
        4 => "Electronics"
        5 => "|--Laptops"
        9 => "|--|--All Laptops"
        7 => "|--Mobiles"
        10 => "|--|--All Mobiles"
        8 => "|--Headphones"
        11 => "|--|--All Headphones"
      ]
    */

    //Result (CASE 2):
    /**
      #items: array:7 [▼
        5 => "Laptops"
        9 => "|-- All Laptops"
      ]
    */
```

```

      @foreach ($categories as $id => $name)
       {{$name}}
      @endforeach

```

#### Generate breadcrumbs for all categories

[](#generate-breadcrumbs-for-all-categories)

```
    $categories = \App\Models\Category::orderByRaw('-position DESC')->get();

    $categories = NestifyX::setIndent(' \ ')->generateBreadCrumbs($categories);

    //will return flattened Result:

    array:7 [▼ // routes\web.php:27
      4 => "Electronics"
      5 => "Electronics \ Laptops"
      9 => "Electronics \ Laptops \ All Laptops"
      7 => "Electronics \ Mobiles"
      10 => "Electronics \ Mobiles \ All Mobiles"
      8 => "Electronics \ Headphones"
      11 => "Electronics \ Headphones \ All Headphones"
    ]
```

#### Generate current breadcrumbs

[](#generate-current-breadcrumbs)

```
    $categories = Category::get();

    $categories = NestifyX::generateCurrentBreadCrumbs($categories,5); //2nd param: child id

    array:2 [▼
      4 => array:2 [▼
        "name" => "Electronics"
        "category" => array:8 [▼
          "id" => 4
          "name" => "Electronics"
          "parent_id" => null
          "created_at" => "2024-02-18T13:37:52.000000Z"
          "updated_at" => "2024-02-22T16:40:00.000000Z"
        ]
      ]
      5 => array:2 [▼
        "name" => "Laptops"
        "category" => array:8 [▼
          "id" => 5
          "name" => "Laptops"
          "parent_id" => 4
          "created_at" => "2024-02-18T13:43:26.000000Z"
          "updated_at" => "2024-02-22T16:40:00.000000Z"
        ]
      ]
    ]
```

```
//in view

       Home
      @foreach ($categories as $category)
       \ {{$category['name']}}
      @endforeach

```

#### Get all parent ids of a child category

[](#get-all-parent-ids-of-a-child-category)

```
    $categories = Category::get();

    $categories = NestifyX::collectParentIds($categories,11);
```

#### Get all child ids of a parent category

[](#get-all-child-ids-of-a-parent-category)

```
    $categories = Category::get();

    $categories = NestifyX::collectChildIds($categories,4);
```

### Upcoming Feature

[](#upcoming-feature)

> - Add Nestable2 plugin feature in Categories
> - Remove Alpine js dependency
> - Add support for bootstrap

New features suggestions are always welcome ### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Code Axion](https://github.com/code-axion)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

813d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4365f50d446464e3c7fa6d0ccb84396ac6136bc2420bcba8f6f9ff57310278bf?d=identicon)[CODE-AXION](/maintainers/CODE-AXION)

---

Top Contributors

[![CODE-AXION](https://avatars.githubusercontent.com/u/97381867?v=4)](https://github.com/CODE-AXION "CODE-AXION (21 commits)")

---

Tags

alpinejsdrag-and-dropjavascriptjqueryjstreelaravellaravel-frameworklaravel-packagepackagephppluginrecursionreorderingtailwindcssui

### Embed Badge

![Health badge](/badges/codeaxion-nestifyx/health.svg)

```
[![Health](https://phpackages.com/badges/codeaxion-nestifyx/health.svg)](https://phpackages.com/packages/codeaxion-nestifyx)
```

###  Alternatives

[cubeta/cubeta-starter

Cubeta-Starter: A developer's Swiss army knife for seamless CRUD operations. Choose between core integration or dev dependency. Enjoy a user-friendly GUI for code generation, enhancing your development workflow. Say goodbye to repetition, embrace productivity with Cubeta-Starter!

122.2k](/packages/cubeta-cubeta-starter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
