brnbio / laravel-loremipsum
Lorem ipsum generator for laravel
This package's canonical repository appears to be gone and the package has been frozen as a result.
1.0.0
2020-08-07 09:37 UTC
Requires
- php: ^7.2
- fzaninotto/faker: ^1.9
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2023-04-12 00:18:47 UTC
README
Easy Lorem ipsum generator for laravel. Generate easy text, paragraphs or placeholder images.
Installation
composer require --dev brnbio/laravel-loremipsum
It's recommended to use this package in dev environment only.
Usage
Random text
public function text($words = self::TEXT_MIN_LENGTH): string
echo lorem()->text(); // result: qui fugiat quasi laboriosam nemo commodi... [default: 200 words] // fixed word count echo lorem()->text(3); // random word count echo lorem()->text([1, 10]);
Html paragraph
Same as text, but with paragraph tags. Return type is a HtmlString.
public function paragraphs(int $count = 1, $words = self::TEXT_MIN_LENGTH): HtmlString
echo lorem()->paragraph(); // <p>qui fugiat quasi laboriosam nemo commodi ...[default: 200]</p> echo lorem()->paragraph(2); // <p>qui fugiat quasi laboriosam nemo commodi ...[default: 200]</p> // <p>quia velit ut eum deleniti qui est ex numquam ...[default: 200]</p> echo lorem()->paragraph(2, [1, 10]); // <p>qui fugiat quasi</p> // <p>quia velit ut eum deleniti qui est ex numquam</p>
Image
Return type HtmlString.
public function image(int $width = 640, int $height = null): string
echo lorem()->image(); // result: <img src="https://via.placeholder.com/640" alt="placeholder image" border="0"> echo lorem()->image(100); // result: <img src="https://via.placeholder.com/100" alt="placeholder image" border="0"> echo lorem()->image(240, 150); // result: <img src="https://via.placeholder.com/240x150" alt="placeholder image" border="0">
Fake
Additional fake function to get a faker instance. For more information look at https://github.com/fzaninotto/Faker.
echo lorem()->fake(); // result: Faker\Generator echo lorem()->fake()->address; // result: 20607 Tromp Trace\n Jaymefurt, AR 09783