nathiss / quote-generator-bundle
A simple Symfony 2|3 bundle for generating quotes.
Installs: 30
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.0
- symfony/framework-bundle: ~2.0|~3.0
Requires (Dev)
This package is not auto-updated.
Last update: 2025-02-01 22:19:23 UTC
README
A simple Symfony 2|3 bundle for generating quotes.
Installation
Step 1. Install
Open a command console, enter your project directory and execute the following command to download the latest stable version:
$ composer require nathiss/quote-generator-bundle
Step 2. Enable bundle
Enable the bundle by adding it to the list of registred bundles in the app/AppKernel.php
file:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Nathiss\Bundle\QuoteGeneratorBundle\NathissQuoteGeneratorBundle(), // ... ); // ... } // ... }
Step 3. Update database schema
To update schema enter this command:
$ ./bin/console doctrine:schema:update --force
Step 4. Configuration (optional)
You can override the default template by adding these lines to your app/config/config.yml
file:
nathiss_quote_generate: template: 'path/to/your/template.html.twig'
Default: NathissQuoteGeneratorBundle:Default:quote.html.twig
Step 5. Load fixtures (optional)
To load fixtures enter this command:
$ ./bin/console doctrine:fixtures:load
(TIP: add --append
options if you wish not to delete data in your database)
Usage
Execute generate_quote()
function inside your twig template:
{# ... #} {{ generate_quote() }} {# ... #}
will render as:
{# ... #} <blockquote class="nathiss-quote"> <p>Some quote</p> <span class="nathiss-quote-author">Some author</span> </blockquote> {# ... #}
License
See the license file.