Overview
, (*1)
This Symfony bundle allows to integrate a Tip Manager in your Symfony application.
The Tip Manager shows you tips relevant to your application. The tips can be seen in different languages., (*2)
The idea is to:
* write tips and their translations in files (yml) for at least one language (the default language of your website for example).
* load tips and their translations into the database by using command line.
* freely edit/add translation through an edition page., (*3)
You can also provide feedback for a tip through like/dislike buttons.
The feedback and other details related to the tips can be viewed on a stats page., (*4)
Here is a screenshot of what an example tip looks like:, (*5)
, (*6)
Installation
Add the bundle to your composer.json
file:, (*7)
require: {
// ...
"tamago/tips-manager-bundle": "dev-master"
}
Or install directly through composer with:, (*8)
# Latest stable
composer require tamago/tips-manager-bundle dev-master
Then run a composer update:, (*9)
composer update
# OR
composer update tamago/tips-manager-bundle # to only update the bundle
TamagoTipManagerBundle also installs LexikTranslationManagerBundle which it uses as the mechanism for storing and
editing translated tips. Make sure both bundles are registered with your kernel:, (*10)
// in AppKernel::registerBundles()
$bundles = array(
// ...
new Tamago\TipsManagerBundle\TamagoTipsManagerBundle(),
new Lexik\Bundle\TranslationBundle\LexikTranslationBundle(), //if you don't have this installed already
// ...
);
Integration
:warning: Although LexikTranslationManagerBundle supports Doctrine storage types, TamagoTipManagerBundle currently only
formally supports Doctrine ORM., (*11)
Creating the database schema
php app/console doctrine:database:create
php app/console doctrine:schema:update
Render in the pages where you want the tips to show up
{{ render(controller('TamagoTipsManagerBundle:TipsManager:index', {'domain': 'some-domain-name', 'identifier': 'my-identifier'})) }}
The values of 'domain' and 'identifier' attributes in above should respectively be the custom names of the domain and identifier which the tips belong to.
You can split tips into multiple categories/domains., (*12)
Configuration
Minimum Configuration
You can skip this step if you are already using LexikTranslationBundle., (*13)
You must at least define a fallback locale(s)., (*14)
lexik_translation:
fallback_locale: [<locale>]
managed_locales: [ <locale1>, <local2>, ... ]
storage:
type: orm
object_manager: <entity/object manager name>
Import translations
To import translations files content into your database, place tip translation YAML files somewhere in your project
and import from the directory. For example:, (*15)
php app/console lexik:translations:import -p app/Resources/translations/tips/
See tips-example.en.yml for an example of a simple translation file., (*16)
Routing
To use the tamago based admin pages, add this to routing file of your application:, (*17)
# app/config/routing.yml
tip_bundle_homepage:
resource: "@TamagoTipsManagerBundle/Resources/config/routing.yml"
prefix: /_tips
The stats page will be available here:, (*18)
A screenshot of the stats page:
, (*19)
The page to edit/add tips will be available here:, (*20)
A screenshot of the edition page:
, (*21)