Download the PHP package liubinas/upvote-bundle without Composer
On this page you can find all versions of the php package liubinas/upvote-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download liubinas/upvote-bundle
More information about liubinas/upvote-bundle
Files in liubinas/upvote-bundle
Package upvote-bundle
Short Description Upvote and downvote (aka thumbs up) bundle for Symfony project
License MIT
Informations about the package upvote-bundle
LtUpvoteBundle
LtUpvoteBundle is upvote and downvote (thumbs up and thumbs down) component for Symfony 3.0 project
Features
- Configurable vote permissions
- Automatically limit unauthenticated upvotes/downvotes by IP
- Optionally hide upvote/downvote button
- Pure JavaScript frontend component implementation
- Unit tested
System requirements
- Symfony 3.0
- Doctrine bundle with configured database connection
Installation
-
Require LtUpvoteBundle over composer in your existing Symfony project:
-
Initialize it in the app/AppKernel.php file:
-
Import LtUpvoteBundle routing:
- Create required database tables:
Configuration
The following is an example configuration defining basic context types blog-post
and
comment
:
Test run
Start web server:
Test page could be accessed by navigating to
http://<dev-host>/lt-upvote-test
on your dev
environment.
Front-end
Front-end functionality is implemented in a single dependency free JavaScript file. Styles are defined in CSS file which could be used out of the box or adopted according to custom requirements.
JavaScript
-
Include JavaScrip module file (Twig syntax):
- Initialize JavaScript module in your HTML page:
CSS
- Include basic CSS file in your html
<head>
section:
Twig
- Include one or more front end components into your page rendered over Controller
Where:
[TYPE]
is context type value.[ID]
is Subject ID value.[CLASS]
is component specific styling CSS class. Predefined styles areStyle1
,Style2
.
See test.html.twig file for example implementation.
JavaScript Custom Event handling
On each upvote/downvote action JavaScript event is dispatched.
This action could be handled by adding custom event listener for ltu
event type.
An example code for unauthenticated downvote handling:
The following properties describing performed action could be accessed from even.detail
data object: id
, type
, counter
, action
, unauthentificated
, unauthentificatedError
.
License
This bundle is under the MIT license. See the complete license in LICENSE file. f
All versions of upvote-bundle with dependencies
symfony/framework-bundle Version ^3.0
doctrine/orm Version ^2.0
symfony/var-dumper Version ^3.0