PHPackages                             escapeboy/jraty - 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. escapeboy/jraty

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

escapeboy/jraty
===============

Package for item ratings + optional microdata format.

125902[2 issues](https://github.com/escapeboy/jraty/issues)JavaScript

Since Jun 16Pushed 11y ago2 watchersCompare

[ Source](https://github.com/escapeboy/jraty)[ Packagist](https://packagist.org/packages/escapeboy/jraty)[ RSS](/packages/escapeboy-jraty/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel 4 Rating Package
========================

[](#laravel-4-rating-package)

Rating Package using jQuery Raty plugin for item ratings + optional microdata format.

[![alt text](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67 "1")](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67)[![alt text](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67 "2")](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67)[![alt text](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67 "3")](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67)[![alt text](https://camo.githubusercontent.com/5b0b476c1167eb4454e64741992fd295195fae09cfddbd4786510f7266a73ea8/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f66662e706e67 "4")](https://camo.githubusercontent.com/5b0b476c1167eb4454e64741992fd295195fae09cfddbd4786510f7266a73ea8/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f66662e706e67)[![alt text](https://camo.githubusercontent.com/5b0b476c1167eb4454e64741992fd295195fae09cfddbd4786510f7266a73ea8/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f66662e706e67 "5")](https://camo.githubusercontent.com/5b0b476c1167eb4454e64741992fd295195fae09cfddbd4786510f7266a73ea8/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f66662e706e67)

The package is doing everything for you - from displaying rating to receiving rating and stores it into database.

---

Installation
============

[](#installation)

```
{
    ...
    "require": {
        "escapeboy/jraty": "dev-master"
    }
}

```

Register in `app/config/app.php`

```
'providers' => array(
    'Escapeboy\Jraty\JratyServiceProvider',
)
```

Creating table for ratings

```
php artisan migrate --package="escapeboy/jraty"

```

Publish jQuery Raty assets

```
php artisan asset:publish escapeboy/jraty

```

Prepare for usage
=================

[](#prepare-for-usage)

First you need to load jQuery

```

```

then need to load Raty plugin. You can use it like this:

```
echo Jraty::js()
```

or

```

```

After we need to initialize Raty plugin.

Using library:

```
echo Jraty::js_init($params=array());
```

Jraty::js\_init accepts array with options for Raty. More info can be found on [Raty website](http://wbotelhos.com/raty)

For example this and it is default:

```
Jraty::js_init(array(
    'score' => 'function() { return $(this).attr(\'data-score\'); }',
    'number' => 5,
    'click' => 'function(score, evt) {
                $.post(\'save/item_rating\',{
                    item_id: $(\'[data-item]\').attr(\'data-item\'),
                    score: score
                });
              }',
    'path' => '\'packages/escapeboy/jraty/raty/lib/img\''
));
```

returns

```
$(document).ready(function () {
    $('#item-rating').raty({
        'score': function () {
            return $(this).attr('data-score');
        },
        'number': 5,
        'click': function (score, evt) {
            $.post('save/item_rating', {
                item_id: $('[data-item]').attr('data-item'),
                score: score
            });
        },
        'path': 'packages/escapeboy/jraty/raty/lib/img'
    });
});
```

**Important:** If you noticed in php call single quotes are escaped.

Usage
=====

[](#usage)

```
echo Jraty::html($item_id, $item_name='', $item_photo='', $seo=true);
```

*If you are using seo option (true by default) its good to set a item\_name*

And result will be [![alt text](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67 "1")](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67)[![alt text](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67 "2")](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67)[![alt text](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67 "3")](https://camo.githubusercontent.com/5b761e584e8634a992a65bda210667f6ef27106b1614b35234a983cd1b3c9eb5/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f6e2e706e67)[![alt text](https://camo.githubusercontent.com/5b0b476c1167eb4454e64741992fd295195fae09cfddbd4786510f7266a73ea8/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f66662e706e67 "4")](https://camo.githubusercontent.com/5b0b476c1167eb4454e64741992fd295195fae09cfddbd4786510f7266a73ea8/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f66662e706e67)[![alt text](https://camo.githubusercontent.com/5b0b476c1167eb4454e64741992fd295195fae09cfddbd4786510f7266a73ea8/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f66662e706e67 "5")](https://camo.githubusercontent.com/5b0b476c1167eb4454e64741992fd295195fae09cfddbd4786510f7266a73ea8/687474703a2f2f77626f74656c686f732e636f6d2f726174792f6c69622f696d616765732f737461722d6f66662e706e67)

*Library is accepting only one rating per item from single IP.*

Additional
----------

[](#additional)

Deleting record

```
Jraty::delete($id)
```

Adding manual rating

```
$data = array(
    		'item_id'    => Input::get('item_id'),
			'score'      => Input::get('score'),
			'added_on'   => DB::raw('NOW()'),
			'ip_address' => Request::getClientIp()
		);
Jraty::add($data);
```

Getting rating data for item

```
$rating = Jraty::get($item_id);
echo $rating->avg; // avarage score
echo $rating->votes; // total votes
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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/65ef8df08f1932ef79020d023bbf1853ae320e4d93061a318bd8e321525d6528?d=identicon)[escapeboy](/maintainers/escapeboy)

---

Top Contributors

[![escapeboy](https://avatars.githubusercontent.com/u/115266?v=4)](https://github.com/escapeboy "escapeboy (8 commits)")

### Embed Badge

![Health badge](/badges/escapeboy-jraty/health.svg)

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

###  Alternatives

[eonasdan/bootstrap-datetimepicker

Date/time picker widget based on twitter bootstrap

7.2k492.4k9](/packages/eonasdan-bootstrap-datetimepicker)

PHPackages © 2026

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