PHPackages                             oachoor/rating-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. oachoor/rating-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

oachoor/rating-bundle
=====================

Provides star rating functionality for Symfony

52105[2 issues](https://github.com/oachoor/RatingBundle/issues)PHP

Since Dec 19Pushed 6y ago3 watchersCompare

[ Source](https://github.com/oachoor/RatingBundle)[ Packagist](https://packagist.org/packages/oachoor/rating-bundle)[ RSS](/packages/oachoor-rating-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

RatingBundle ⭐
==============

[](#ratingbundle-star)

This Symfony bundle provides integration of a star rating system.

### Requirements

[](#requirements)

- PHP 7.2+
- MySQL 5.7.20+
- Symfony 4.3+

### 📦 Installation

[](#package-installation)

Install bundle with `Composer` dependency manager first by running the command:

`$ composer req oachoor/rating-bundle`

### Add routes

[](#add-routes)

```
oa_rating:
    resource: '@RatingBundle/Controller'
    type: annotation
```

### (Optional) Create your own Entities

[](#optional-create-your-own-entities)

Entities doesn't fully meet your requirements?, then you can create yours based on [Rating](Entity/Rating.php) and [Vote](Entity/Vote.php).

### Resolve abstract Entities with RatingBundle or your custom ones

[](#resolve-abstract-entities-with-ratingbundle-or-your-custom-ones)

```
doctrine:
    orm:
        resolve_target_entities:
            RatingBundle\Model\AbstractVote: RatingBundle\Entity\Vote or AcmeRatingBundle\Entity\Vote
            RatingBundle\Model\AbstractRating: RatingBundle\Entity\Rating or AcmeRatingBundle\Entity\Rating
            Symfony\Component\Security\Core\User\UserInterface: RatingBundle\Entity\User or AcmeRatingBundle\Entity\User
```

### Define mapping Bundle

[](#define-mapping-bundle)

Make sure you have registered the Bundle that holds the Entities as following:

```
doctrine:
    orm:
        entity_managers:
            default:
                mappings:
                    RatingBundle: ~ or AcmeRatingBundle: ~
```

### Update database schema

[](#update-database-schema)

```
$ bin/console doctrine:schema:update --force --no-debug
```

### Using voting strategy

[](#using-voting-strategy)

There are two strategies for rating, based on IP addresses or cookies. (both? feel free to contribute)

```
oa_rating:
    strategy: cookie (default "ip")
    cookie_name: your_custom_name
    cookie_lifetime: '+1 year'
```

### Templates customization

[](#templates-customization)

Templates can be overridden in the `/templates/bundles/RatingBundle/` directory, the new templates must use the same name and path (relative to `RatingBundle/Resources/views/`) as the original templates.

To override the `Resources/views/rating/view.html.twig` template, create this template: `/templates/bundles/RatingBundle/rating/view.html.twig`

### Usage

[](#usage)

To see rating result for a Content (read-only mode), use the following twig code:

```
{{ render( controller( 'RatingBundle:Rating:result', {'contentId': yourContentId} ) ) }}
```

Rating is based on Content, to enable voting for a Content use the following twig code:

```
{{ render( controller( 'RatingBundle:Rating:vote', {'contentId': yourContentId} ) ) }}
```

### Example

[](#example)

A minimal [Template](Resources/views/rating/view.html.twig) that contains rating-call, javascripts and stylesheets.

Todos
-----

[](#todos)

- Make User dependencies optional.
- Write some Unit Tests.
- Add Fixtures.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc1791c868c41d1a968c157df2ae180c95f0da0f6c654c60af58d342e3d68952?d=identicon)[oachoor](/maintainers/oachoor)

---

Top Contributors

[![oachoor](https://avatars.githubusercontent.com/u/7025827?v=4)](https://github.com/oachoor "oachoor (31 commits)")[![matthiaskrieft](https://avatars.githubusercontent.com/u/71022?v=4)](https://github.com/matthiaskrieft "matthiaskrieft (1 commits)")[![svenjehles](https://avatars.githubusercontent.com/u/4731182?v=4)](https://github.com/svenjehles "svenjehles (1 commits)")

---

Tags

php71ratingsymfony4vote

### Embed Badge

![Health badge](/badges/oachoor-rating-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/oachoor-rating-bundle/health.svg)](https://phpackages.com/packages/oachoor-rating-bundle)
```

###  Alternatives

[netzmacht/contao-leaflet-maps

Contao Leaflet maps integration

1111.0k1](/packages/netzmacht-contao-leaflet-maps)

PHPackages © 2026

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