PHPackages                             opositatest/interest-user-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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. opositatest/interest-user-bundle

AbandonedArchivedSymfony-bundle[Authentication &amp; Authorization](/categories/authentication)

opositatest/interest-user-bundle
================================

User Interests, follow &amp; unfollow

0818PHP

Since Feb 13Pushed 6y ago3 watchersCompare

[ Source](https://github.com/opositatest/InterestUserBundle)[ Packagist](https://packagist.org/packages/opositatest/interest-user-bundle)[ RSS](/packages/opositatest-interest-user-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (3)Used By (0)

INSTALLATION
============

[](#installation)

Basic Installation...
---------------------

[](#basic-installation)

### Composer install

[](#composer-install)

composer require opositatest/interest-user-bundle

### Add bundle to AppKernel:

[](#add-bundle-to-appkernel)

```
# app/AppKernel.php
new Opositatest\InterestUserBundle\OpositatestInterestUserBundle(),
```

Connect with User
-----------------

[](#connect-with-user)

### Trait for your User Entity

[](#trait-for-your-user-entity)

```
# src/AppBundle/Entity/User
    ...
    // Add trait
    use \Opositatest\InterestUserBundle\Model\UserTrait {
        __construct as _traitconstructor;
    }
    ...
    // Add construct
    public function __construct()
    {
        $this->_traitconstructor();
        parent::__construct();
    }
```

### Add fields in UserAdmin Class

[](#add-fields-in-useradmin-class)

You need add followInterests and unfollowInterests to UserAdmin Class, so:

```
# src/AppBundle/Admin/UserAdmin
    protected function configureFormFields(FormMapper $formMapper)
    {
        ...
            ->add('followInterests', 'sonata_type_model', array('multiple' => true, 'by_reference' => false))
            ->add('unfollowInterests', 'sonata_type_model', array('multiple' => true, 'by_reference' => false))
        ...
    }
```

Add validate function, so:

```
    public function validate(ErrorElement $errorElement, $object)
    {
        /** @var SyliusUser $user */
        $user = $object;
        foreach($user->getFollowInterests() as $followInterest) {
            if ($user->existUnfollowInterest($followInterest)) {
                $custom_error = "Interest ".$followInterest." used in follow and unfollow";
                $errorElement->with( 'enabled' )->addViolation( $custom_error )->end();
            }
        }
    }
```

### Configuration config.yml

[](#configuration-configyml)

```
# app/config/config.yml
orm:
   resolve_target_entities:
      Opositatest\InterestUserBundle\Model\UserInterface: AppBundle\Entity\User
```

Add routes
----------

[](#add-routes)

Add routes to your project. It should be compatible with nelmio api doc

```
# app/config/routing.yml
opositatest_interestuser_api:
    resource: "@OpositatestInterestUserBundle/Resources/config/routing.yml"
    prefix:   /api/ # Prefix is customizable
```

API
---

[](#api)

Enable annotations for group feature

```
# app/config/config.yml
framework:
    # ...
    serializer:
        enable_annotations: true
```

Connect with SonataAdmin (optional)
-----------------------------------

[](#connect-with-sonataadmin-optional)

Add OpositatestInterestUserBundle group:

```
# app/config/config.yml
sonata_admin:
    ...
    dashboard:
        ...
        groups:
            OpositatestInterestUserBundle:
                label: "Intereses de Usuario"
        blocks:
            - { position: right, type: sonata.admin.block.admin_list, settings: { groups: [OpositatestInterestUserBundle] } }

```

USAGE
=====

[](#usage)

We have three functions, "/api/" is customizable prefix url:

Add interest
------------

[](#add-interest)

It add interest to logged user

```
POST
/api/interest/{interest}

```

Remove interest
---------------

[](#remove-interest)

It remove interest to logged user

```
DELETE
/api/interest/{interest}

```

View interests
--------------

[](#view-interests)

It return interests global and for logged user

```
GET
/api//interests

```

Test
====

[](#test)

You can try unit test with:

```
./vendor/bin/phpunit vendor/opositatest/interest-user-bundle/Opositatest/InterestUserBundle

```

Información adicional
=====================

[](#información-adicional)

El bundle gestiona los intereses de un usuario, permite añadir y eliminar followInterest y unfollowInterest.

Tiene dos lógicas importantes implementadas:

1. Cuando añades un nuevo interés en followInterest o unfollowInterest el sistema añade los intereses hijo automáticamente. Este proceso se hace a través de la Entidad Interest en el caso de que se use SonataAdmin y en el servicio InterestService en el caso de que se use la API. Esta diferenciación es así porque a través de la API necesitamos comprobar el punto 2, mientras que a través de Sonata el punto 2 ya se comprueba con una función especial en el propio Sonata.
2. No puede haber un mismo interés en followInterest y unfollowInterest, por tanto, en Sonata se comprueba a través de una función de validación, y en la API se hace cada vez que se incorpora un nuevo interés.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 62.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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/33d23db34cdb32dd20ebae582d101d7eb48777143e993dd19bbc89d3275c5ae2?d=identicon)[Chrysweel](/maintainers/Chrysweel)

---

Top Contributors

[![hidabe](https://avatars.githubusercontent.com/u/50526?v=4)](https://github.com/hidabe "hidabe (32 commits)")[![p-carrillo](https://avatars.githubusercontent.com/u/6990956?v=4)](https://github.com/p-carrillo "p-carrillo (16 commits)")[![jdeveloper](https://avatars.githubusercontent.com/u/8874?v=4)](https://github.com/jdeveloper "jdeveloper (3 commits)")

---

Tags

bundlessymfonysymfony-bundle

### Embed Badge

![Health badge](/badges/opositatest-interest-user-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/opositatest-interest-user-bundle/health.svg)](https://phpackages.com/packages/opositatest-interest-user-bundle)
```

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.2M17](/packages/kartik-v-yii2-password)

PHPackages © 2026

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