PHP code example of apoutchika / loremipsum-bundle

1. Go to this page and download the library: Download apoutchika/loremipsum-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

apoutchika / loremipsum-bundle example snippets



// app/AppKernel.php

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


$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



// 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));
//...