PHPackages                             dantleech/phpcr-taxonomy-bundle - 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. [Database &amp; ORM](/categories/database)
4. /
5. dantleech/phpcr-taxonomy-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

dantleech/phpcr-taxonomy-bundle
===============================

Taxonomy Bundle for PHPCR-ODM

6401PHP

Since Jan 3Pushed 11y ago4 watchersCompare

[ Source](https://github.com/dantleech/PhpcrTaxonomyBundle)[ Packagist](https://packagist.org/packages/dantleech/phpcr-taxonomy-bundle)[ RSS](/packages/dantleech-phpcr-taxonomy-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

PHPCR Taxonomy Bundle
=====================

[](#phpcr-taxonomy-bundle)

[![Build Status](https://camo.githubusercontent.com/a14beb5c61590a9f16b7ec9986d4e3851cf3d83922ef1cc56c1dc9ee156169ba/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f64616e746c656563682f50687063725461786f6e6f6d7942756e646c652e706e67)](http://travis-ci.org/dantleech/PhpcrTaxonomyBundle)[![Latest Stable Version](https://camo.githubusercontent.com/27530bf10b7042e99d6c61a44ef38bf7d759f8a254da220891046391f2fd01f3/68747470733a2f2f706f7365722e707567782e6f72672f64616e746c656563682f70687063722d7461786f6e6f6d792d62756e646c652f76657273696f6e2e706e67)](https://packagist.org/packages/dantleech/phpcr-taxonomy-bundle)[![Total Downloads](https://camo.githubusercontent.com/952f0eb60fe5127f2be2dd89191ed187d9176f1a247fe3d43094c0bd9ac1b615/68747470733a2f2f706f7365722e707567782e6f72672f64616e746c656563682f70687063722d7461786f6e6f6d792d62756e646c652f642f746f74616c2e706e67)](https://packagist.org/packages/dantleech/phpcr-taxonomy-bundle)

What works:

- Automatically creating tag objects at spsecified paths
    - Paths effectively act as taxonomies
- Automatic tag object association with target document
- Taxon referrer count, because PHPCR-ODM doesn't do aggregation. (for tag clouds for example)
- Command to "fix" or initialize taxon referrer counts

What is planned:

- Orphan removal
- Static taxonomies - i.e. specify if new taxons can be created.
- Hierachical tagging, e.g. specify "Laptops &gt; Levono &gt; X200" as a tag, creating a 3 level heierachy.

This is a very specific taxonomy bundle for PHPCR.

Basic Usage
-----------

[](#basic-usage)

For each document you wish to be tagged you need to add two property annotations, `@Taxons` and `@TaxonObjects`. The first will automatically be mapped to an array, the second will contain a collection of the actual taxon objects.

```
namespace DTL\PhpcrTaxonomyBundle\Tests\Resources\Document;

use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
use DTL\PhpcrTaxonomyBundle\Metadata\Annotations as PhpcrTaxonomy;

/**
 * @PHPCR\Document(referenceable=true)
 */
class Post
{
    /**
     * @PHPCR\Id()
     */
    public $id;

    /**
     * @PHPCR\ParentDocument()
     */
    public $parent;

    /**
     * @PhpcrTaxonomy\Taxons(path="/test/taxons")
     */
    public $tags;

    /**
     * @PhpcrTaxonomy\TaxonObjects()
     */
    public $tagObjects;
}
```

Tags can be set as follows:

```
$post = new Post();
$post->tags = array('one', 'two');
```

The parent document for each taxon is determined by the `path` property of the `Taxons` annotation. It must exist before persisting the document.

Alternative Taxon Classes
-------------------------

[](#alternative-taxon-classes)

You can specify an alternative taxon class as follows:

```
namespace DTL\PhpcrTaxonomyBundle\Tests\Resources\Document;

use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
use DTL\PhpcrTaxonomyBundle\Metadata\Annotations as PhpcrTaxonomy;

/**
 * @PHPCR\Document(referenceable=true)
 */
class Post
{
    // ...

    /**
     * @PhpcrTaxonomy\Taxons(path="/test/taxons", taxonClass="MyBundle\MyTaxonClass")
     */
    public $tags;
}
```

Taxon Referrer Count
--------------------

[](#taxon-referrer-count)

The Doctrine subscriber automatically records the number of referrers each taxon document has. For example if a taxon is used by 5 posts, then that taxon has 5 referrers.

This is especially useful if you want to show a tag cloud which weights taxons by the number of times that they are referenced.

Note that if you implement a custom taxon document you must implement both `getReferrerCount` and `setReferrerCount` and store the field as a `Long`.

The taxon referrer count for each taxon is updated whenever a taxon is associated or disassociated with a document. If for some reason this data becomes corrupted you can launch the following command to reinitialize this data:

```
$ php app/console phpcr-taxonomy:update-referrer-count
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity43

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/24ec7d5d6b7ea54007be5d7b4f43800381cc1e22929f7d2276fba30e497fdfa6?d=identicon)[dantleech](/maintainers/dantleech)

---

Top Contributors

[![dantleech](https://avatars.githubusercontent.com/u/530801?v=4)](https://github.com/dantleech "dantleech (17 commits)")

### Embed Badge

![Health badge](/badges/dantleech-phpcr-taxonomy-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/dantleech-phpcr-taxonomy-bundle/health.svg)](https://phpackages.com/packages/dantleech-phpcr-taxonomy-bundle)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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