PHPackages                             phracktale/symfony-form-tree - 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. phracktale/symfony-form-tree

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

phracktale/symfony-form-tree
============================

create select field with indentation for tree structure

v1.0.2(9y ago)03MITPHPPHP &gt;=5.5.9

Since Aug 21Pushed 5y agoCompare

[ Source](https://github.com/phracktale/symfony-form-tree)[ Packagist](https://packagist.org/packages/phracktale/symfony-form-tree)[ RSS](/packages/phracktale-symfony-form-tree/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (8)Versions (10)Used By (0)

Symfony Form Tree extension
===========================

[](#symfony-form-tree-extension)

[![Build Status](https://camo.githubusercontent.com/2ffecc30479013eb729e3e7c3d3d9f2ae4cc114d986ddf7929648f16d246737c/68747470733a2f2f7472617669732d63692e6f72672f596176696e2f73796d666f6e792d666f726d2d747265652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Yavin/symfony-form-tree)

This extension provide displaying doctrine tree entity types in synfony forms. It add a prefix to option names in select list that indicates tree level.

It is tested and should work with symfony 3.0+

If want to use this in symfony 2 look at "symfony-2" branch of this extension

[![](doc/example.png)](doc/example.png)

```

    Motors
    Electronics
    -Cell phones
    --Samsung
    -Computers
    Fasion

```

Instalation
-----------

[](#instalation)

1. With composer.json

    ```
    composer require yavin/symfony-form-tree:^1.0

    ```
2. Add type guesser in your services file (**optional**):

    ```

    ```

    or if you use `yml` format:

    ```
    services:
        symfony.form.type_guesser.tree:
            class: Yavin\Symfony\Form\Type\TreeTypeGuesser
            arguments: [ "@doctrine" ]
            tags:
                - { name: form.type_guesser }
    ```
3. Then add field to tree model. In this example

    ```
    use Yavin\Symfony\Form\Type\TreeType;

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('category'); //extension will guess field type

        //or this is full example with default options:

        $builder->add('category', TreeType::class, [
            'class' => Category::class, // tree class
            'levelPrefix' => '-',
            'orderFields' => ['treeLeft' => 'asc'],
            'prefixAttributeName' => 'data-level-prefix',
            'treeLevelField' => 'treeLevel',
        ]);
    }
    ```

    This extension assume that in tree model You have `treeLeft` and `treeLevel` fields. It can be changed in field options.

    [Here](tests/Fixtures/Category.php) is example tree entity.

Other
-----

[](#other)

- [Custom, callback provided prefix](doc/custom_prefix.md)
- [Set default options to all tree select fields](doc/default_options.md)

License
-------

[](#license)

[MIT](https://opensource.org/licenses/MIT)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

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

Every ~151 days

Recently: every ~113 days

Total

7

Last Release

3376d ago

Major Versions

v0.3 → v1.0.02016-01-17

v0.4 → v1.0.12016-12-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a4963487b9d49f75ac6dfcafcb4fca58c947a43a5f5532cc7c32c7441d7ba4c?d=identicon)[phracktale](/maintainers/phracktale)

---

Top Contributors

[![Yavin](https://avatars.githubusercontent.com/u/1175856?v=4)](https://github.com/Yavin "Yavin (13 commits)")[![LouTerrailloune](https://avatars.githubusercontent.com/u/863742?v=4)](https://github.com/LouTerrailloune "LouTerrailloune (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phracktale-symfony-form-tree/health.svg)

```
[![Health](https://phpackages.com/badges/phracktale-symfony-form-tree/health.svg)](https://phpackages.com/packages/phracktale-symfony-form-tree)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[wallabag/wallabag

open source self hostable read-it-later web application

12.6k2.2k](/packages/wallabag-wallabag)

PHPackages © 2026

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