PHPackages                             waltertamboer/wtrating - 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. waltertamboer/wtrating

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

waltertamboer/wtrating
======================

A Zend Framework 2 module that provides functionality to rate or like something.

6452PHP

Since Nov 4Pushed 13y ago1 watchersCompare

[ Source](https://github.com/waltertamboer/WtRating)[ Packagist](https://packagist.org/packages/waltertamboer/wtrating)[ RSS](/packages/waltertamboer-wtrating/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

WtRating
========

[](#wtrating)

Version 0.0.1

[![Build Status](https://camo.githubusercontent.com/612d6ac89e1018cc47157e1b3094a161e3bd5a5f6fe56411a98c7a877f304606/68747470733a2f2f7472617669732d63692e6f72672f57616c74657254616d626f65722f5774526174696e672e706e67)](https://travis-ci.org/WalterTamboer/WtRating)

Introduction
------------

[](#introduction)

This is a Zend Framework 2 module that provides functionality to rate or like something.

Requirements
------------

[](#requirements)

- [Zend Framework 2](https://github.com/zendframework/zf2)

Installation
------------

[](#installation)

Add this repository as a submodule to your repository or install using Composer:

```
{
    "require": {
        "waltertamboer/wtrating": "*"
    }
}

```

Usage
-----

[](#usage)

### Setup

[](#setup)

Setup the mapper that you want to use. By default this module only comes with a Zend\\Db mapper.

```
'service_manager' => array(
    'factories' => array(
        'wtrating.mapper' => function ($sm) {
            $dbAdapter = $sm->get('... db adapter ...');
            return new \WtRating\Mapper\ZendDbMapper($dbAdapter);
        }
    ),
)

```

### Rate something

[](#rate-something)

To add a rating you could do the following:

```
public function indexAction()
{
    // The id of the user that is currently logged in or null if there is no user:
    $userId = ...;

    // The type that identifies the rating:
    $typeId = 'my-article-163';

    // The rating to set, make something up:
    $rating = rand();

    $serviceLocator = $this->getServiceLocator();

    // Create a new rating:
    $rating = $serviceLocator->create('wtrating.rating');
    $rating->setTypeId($typeId);
    $rating->setUserId($userId);
    $rating->setRating($rating);

    // Save the rating to the storage device:
    $ratingService = $serviceLocator->get('wtrating.service');
    $ratingService->persist($rating);

    // Retrieve the rating set that contains information like avarage rating,
    // amount of rates, etc.
    return new ViewModel(array(
        'ratingSet' => $ratingService->getRatingSet($typeId)
    ));
}

```

### Show ratings

[](#show-ratings)

There is a view helper that can be invoked:

```
$this->wtRating($ratingSet);

```

It's possible to add attributes as well:

```
$this->wtRating($this->ratingSet, array(
    'class' => 'rating'
));

```

If you want to change the HTML element you can use the third parameter:

```
$this->wtRating($this->ratingSet, array(), 'div');

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.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/0ee7f711ef4d45ada0ac92c7ab2f548055a7cfbe718da6c4bbb81b2f6693c528?d=identicon)[waltertamboer](/maintainers/waltertamboer)

---

Top Contributors

[![waltertamboer](https://avatars.githubusercontent.com/u/508054?v=4)](https://github.com/waltertamboer "waltertamboer (11 commits)")[![atukai](https://avatars.githubusercontent.com/u/308995?v=4)](https://github.com/atukai "atukai (1 commits)")

### Embed Badge

![Health badge](/badges/waltertamboer-wtrating/health.svg)

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

PHPackages © 2026

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