Lorem: Dummy text and images for Laravel
Sick of copying and pasting lorem ipsum text and placeholder images? Lorem can help you
March 3, 2016
Adding lorem ipsum text and placeholder images for the millionth time?
I’ve created a super small Laravel package for making this boring task a little less annoying.
Install
composer require ecrmnn/lorem
After you have installed open your Laravel config file config/app.php
and add the following lines.
In the $providers array add the service providers for this package.
Ecrmnn\Lorem\LoremServiceProvider::class
Usage
Access Lorem
by using the global helper lorem()
Text
<body>
<div class="content">
<!-- Returns one paragraph of lorem ipsum -->
{!! lorem(1) !!}
</div>
</body>
<body>
<div class="content">
<!-- Returns 23 paragraphs of lorem ipsum -->
{!! lorem(23) !!}
</div>
</body>
Image
<body>
<div class="content">
<!-- Returns an image (1024x1024) -->
{!! lorem()->image() !!}
</div>
</body>
<body>
<div class="content">
<!-- Returns an image (1000x600) with class -->
{!! lorem()->image(1000, 600, ['class' => 'img-responsive']) !!}
</div>
</body>