PHPackages                             teepluss/categorize - 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. teepluss/categorize

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

teepluss/categorize
===================

Laravel 4 Categorize

v0.1(12y ago)293338[2 issues](https://github.com/teepluss/laravel4-categorize/issues)[1 PRs](https://github.com/teepluss/laravel4-categorize/pulls)MITPHPPHP &gt;=5.3.0

Since Nov 26Pushed 12y ago8 watchersCompare

[ Source](https://github.com/teepluss/laravel4-categorize)[ Packagist](https://packagist.org/packages/teepluss/categorize)[ Docs](https://github.com/teepluss/laravel4-categorize.git)[ RSS](/packages/teepluss-categorize/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Multi Level Category.
---------------------

[](#multi-level-category)

Categorize is a category management for Laravel 4.

### Installation

[](#installation)

- [Categorize on Packagist](https://packagist.org/packages/teepluss/categorize)
- [Categorize on GitHub](https://github.com/teepluss/laravel4-categorize)

To get the lastest version of Theme simply require it in your `composer.json` file.

```
"teepluss/categorize": "dev-master"

```

You'll then need to run `composer install` to download it and have the autoloader updated.

Once Attach is installed you need to register the service provider with the application. Open up `app/config/app.php` and find the `providers` key.

```
'providers' => array(

    'Teepluss\Categorize\CategorizeServiceProvider'

)

```

Publish config using artisan CLI.

```
php artisan config:publish teepluss/categorize

```

Migrate tables.

```
php artisan migrate --package=teepluss/categorize

```

Usage
-----

[](#usage)

Creating category as a root.

```
$categorize = Categorize::prepare(array(
    'type'        => 'Product',
    'title'       => 'Hardware',
    'description' => 'Hardware is a ...'
));

$categorize->makeRoot();
```

Creating category as a child of parent.

```
$categorize = Categorize::prepare(array(
    'type'        => 'Product',
    'title'       => 'Hardware - CPU',
    'description' => 'CPU is a ...'
));

$parent = Categorize::getCategoryProvider()->findById(1);
// or
// $parent = Categorize::getCategoryProvider()->findByName('Hardware');

$categorize->makeChildOf($parent);
```

Moving to a new root.

```
$category = Categorize::getCategoryProvider()->findByName('Hardware - CPU');

$category->makeRoot();
```

Moving to another parent.

```
$category = Categorize::getCategoryProvider()->findByName('Hardware - CPU');

$parent = Categorize::getCategoryProvider()->findByName('Software');

$category->makeChildOf($parent);
```

Update information.

```
$category = Categorize::getCategoryProvider()->findByName('Hardware - CPU');
$category->fill(array(
    'title'       => 'Software - Office',
    'description' => 'Documenting'
));

$category->save();
```

Delete with children.

```
$category = Categorize::getCategoryProvider()->findByName('Hardware');

$category->deleteWithChildren();
```

List category as tree.

```
$category = Categorize::getCategoryProvider()->findByName('Hardware');

var_dump($category->getChildren()->toArray());
```

Build categories as tree.

```
$categories = Categorize::getCategoryProvider()->whereType('Blog')->get();

// Build only root categories.

$categories = Categorize::getCategoryProvider()->root()->whereType('Blog')->get();

var_dump(Categorize::tree($categories)->toArray());
```

Using categorize with model.
----------------------------

[](#using-categorize-with-model)

Define relation to model

```
public function categories()
{
    return $this->morphMany('Teepluss\Categorize\CategoryRelates\Relate', 'contentable');
}
```

Push content to a category.

```
$category = Categorize::getCategoryProvider()->findByName('Hardware - CPU');

$blog = Blog::find(24);
$blog->categories()->create(array('category_id' => $category->id));
```

List contents that belongs to a category.

```
$contentIds = Categorize::getCategoryProvider()->findById(1)->relates()->whereContentableType('Blog')->lists('contentable_id');
// or
// $contentIds = Categorize::getCategoryRelateProvider()->whereContentableType('Blog')->whereCategoryId(1)->lists('contentable_id');

$blogs = Blog::find($contentIds);

var_dump($blogs->toArray());
```

Support or Contact
------------------

[](#support-or-contact)

If you have some problem, Contact

[![Support via PayPal](https://camo.githubusercontent.com/1c4c2a63b268ab949717893dda9628735444f61b8eb8eece283a534338b5b0e5/68747470733a2f2f7261776769746875622e636f6d2f63687269732d2d2d2f446f6e6174696f6e2d4261646765732f6d61737465722f70617970616c2e6a706567)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9GEC8J7FAG6JA)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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

4599d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1464300?v=4)[Maximus](/maintainers/teepluss)[@teepluss](https://github.com/teepluss)

---

Top Contributors

[![johnlui](https://avatars.githubusercontent.com/u/2127912?v=4)](https://github.com/johnlui "johnlui (2 commits)")[![buagern](https://avatars.githubusercontent.com/u/294881?v=4)](https://github.com/buagern "buagern (1 commits)")

---

Tags

laravellaravel4categorycategorize

### Embed Badge

![Health badge](/badges/teepluss-categorize/health.svg)

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

###  Alternatives

[bllim/datatables

Server-side handler of DataTables Jquery Plugin for Laravel 4

260416.5k4](/packages/bllim-datatables)[thujohn/rss

RSS builder for Laravel 4

69130.2k3](/packages/thujohn-rss)

PHPackages © 2026

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