2017 © Pedro Peláez
 

symfony-bundle star-rating-bundle

Star Rating Bundle for use with Symfony 2 using Font Awesome. This bundle adds the 'rating' form type and rating filter to render ratings. Simple and easy to use.

image

blackknight467/star-rating-bundle

Star Rating Bundle for use with Symfony 2 using Font Awesome. This bundle adds the 'rating' form type and rating filter to render ratings. Simple and easy to use.

  • Thursday, March 23, 2017
  • by blackknight467
  • Repository
  • 4 Watchers
  • 19 Stars
  • 42,653 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 19 Forks
  • 11 Open issues
  • 8 Versions
  • 11 % Grown

The README.md

StarRatingBundle

Star Rating Bundle for Symfony 3. Requires Jquery and Font Awesome., (*1)

If Using Symfony 2. Use version 1.*, (*2)

Sample Output

alt tag, (*3)

Installation

Step 1: Download the StarRatingBundle

Using Composer, (*4)

Add the following to the "require" section of your composer.json file:, (*5)

    "blackknight467/star-rating-bundle": "2.*"

Step 2: Enable the bundle

Enable the bundle in the kernel:, (*6)

<?php
// app/appKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new blackknight467\StarRatingBundle\StarRatingBundle(),
    );
}

Step 3: Add the css

Add the css in your page head, (*7)

  <link rel="stylesheet" type="text/css" href="{{ asset('bundles/starrating/css/rating.css') }}" />

or, (*8)

    {% stylesheets
      'bundles/starrating/css/rating.css'
      filter="cssrewrite" %}
      <link href="{{ asset_url }}" rel="stylesheet" type="text/css" />
    {% endstylesheets %}

Step 4: Add the js

Add the javascript to your page head, (*9)

    <!-- make sure that jquery is included --!>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
    <script src="{{ asset('bundles/starrating/js/rating.js') }}"></script>

or, (*10)

    <!-- make sure that jquery is included --!>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
    {% javascripts
      '@StarRatingBundle/Resources/public/js/rating.js' %}
      <script src="{{ asset_url }}"></script>
    {% endjavascripts %}

Usage

In a Form

<?php
    // ...
    $builder->add('rating', RatingType::class, [
        'label' => 'Rating'
    ]);
    // ...

or for a custom rating scale:, (*11)

<?php
    // ...
    $builder->add('rating', RatingType::class, [
        //...
        'stars' => 4,
        //...
    ]);
    // ...

Display in a twig template using the rating filter

    // ...
    {{ someInteger|rating }}
    // ...

or if you are not using a 5 star scale, (*12)

{{ someInteger|rating(4) }}

if you want to use the font awesome icon sizes, (*13)

{{ someInteger|rating(5, "fa-3x") }}

If you want the smallest size use "fa-norm" (in font awesome, this would be the same as not providing an size class); providing no size argument sets the font size to 25px which is somewhere in between "fa-lg" and "fa-2x". To customize the size, feel free to override the css., (*14)

License

This bundle is under the MIT license. See the complete license in the bundle: LICENSE, (*15)

The Versions

23/03 2017

dev-master

9999999-dev http://github.com/blackknight467/StarRatingBundle

Star Rating Bundle for use with Symfony 2 using Font Awesome. This bundle adds the 'rating' form type and rating filter to render ratings. Simple and easy to use.

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Derick Felsman
by Steven Ng

symfony2 bundle symfony rating star

12/04 2016

v2.0.1

2.0.1.0 http://github.com/blackknight467/StarRatingBundle

Star Rating Bundle for use with Symfony 2 using Font Awesome. This bundle adds the 'rating' form type and rating filter to render ratings. Simple and easy to use.

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Derick Felsman
by Steven Ng

symfony2 bundle symfony rating star

06/04 2016

v2.0

2.0.0.0 http://github.com/blackknight467/StarRatingBundle

Star Rating Bundle for use with Symfony 2 using Font Awesome. This bundle adds the 'rating' form type and rating filter to render ratings. Simple and easy to use.

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Derick Felsman
by Steven Ng

symfony2 bundle symfony rating star

16/02 2016

v1.0.3

1.0.3.0 http://github.com/blackknight467/StarRatingBundle

Star Rating Bundle for use with Symfony 2 using Font Awesome. This bundle adds the 'rating' form type and rating filter to render ratings. Simple and easy to use.

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Derick Felsman
by Steven Ng

symfony2 bundle symfony rating star

06/04 2015

v1.0.2

1.0.2.0 http://github.com/blackknight467/StarRatingBundle

Star Rating Bundle for use with Symfony 2 using Font Awesome. This bundle adds the 'rating' form type and rating filter to render ratings. Simple and easy to use.

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Derick Felsman
by Steven Ng

symfony2 bundle symfony rating star

03/01 2015

v1.0.1

1.0.1.0 http://github.com/blackknight467/StarRatingBundle

Star Rating Bundle for use with Symfony 2 using Font Awesome. This bundle adds the 'rating' form type and rating filter to render ratings. Simple and easy to use.

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Derick Felsman
by Steven Ng

symfony2 bundle symfony rating star

28/12 2014

v1.0

1.0.0.0 http://github.com/blackknight467/StarRatingBundle

Star Rating Bundle for use with Symfony 2 using Font Awesome. This bundle adds the 'rating' form type and rating filter to render ratings. Simple and easy to use.

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Derick Felsman
by Steven Ng

symfony2 bundle symfony rating star

28/12 2014

v0.5

0.5.0.0 http://github.com/blackknight467/StarRatingBundle

Star Rating Bundle for use with Symfony 2 using Font Awesome. This bundle adds the 'rating' form type and rating filter to render ratings. Simple and easy to use.

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Derick Felsman
by Steven Ng

symfony2 bundle symfony rating star