apoutchika/loremipsum-bundle

Generate paragraphs, sentences and words for your development.

Installs: 59 618

Dependents: 0

Suggesters: 0

Security: 0

Stars: 12

Watchers: 2

Forks: 2

Open Issues: 0

Type:symfony-bundle

v1.0.3 2014-10-05 19:11 UTC

This package is not auto-updated.

Last update: 2024-12-21 15:24:07 UTC


README

Generate paragraphs, sentences and words for your development

Installation

Download LoremIpsumBundle using composer

Add LoremIpsumBundle in your composer.json

{
    "require": {
        "apoutchika/loremipsum-bundle": "dev-master"
    }
}

Enable the bundle on your kernel

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array (
        //...
        new Apoutchika\LoremIpsumBundle\ApoutchikaLoremIpsumBundle(),
    );
}

Use it on controller :

<?php
$loremIpsum = $this->get('apoutchika.lorem_ipsum');

// $paragraphs1 content is aleatory number of paragraphs
$paragraphs = $loremIpsum->getParagraphs();

// $paragraphs2 content is exactly 2 paragraphs
$paragraphs2 = $loremIpsum->getParagraphs(2);

// $paragraphs3 content 2, 3, 4, 5, 6, 7 or 8 paragraphs
$paragraphs3 = $loremIpsum->getParagraphs(2, 8);


// Or with sentences :
$sentences = $loremIpsum->getSentences(1, 3); // 1, 2 or 3 sentences


// Or with words :
$words = $loremIpsum->getWords (2); // return only two words

Set you'r lorem ipsum value

<?php

// for the customers database :

$liName = $this->get('apoutchika.lorem_ipsum');
$liName->setLoremIpsum ('Dupont Dupond Martin Durand Tessier'); // ....

$liFirstName = $this->get('apoutchika.lorem_ipsum');
$liFirstName->setLoremIpsum ('Marie Jean Michel Pierre Philippe'); //...

$user = new User;
$user->setName ($liName->getWords(1));
$user->setFirstName ($liFirstName->getWords(1));
//...

Use it on Twig :

For generate 2 paragraphs :

{{ paragraphs (2) }}

For generate 2, 3, 4 or 5 paragraphs :

{{ paragraphs (2, 5) }}

For sentences and words:

{{ sentences () }}
{{ words () }}

Configuration Reference

see Resources/doc/configuration_reference.md

Licence

See Resources/meta/LICENSE.