Skip to content

netdjw/lorem-ipsum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Multilingual Lorem Ipsum Generator for Laravel

Install

Install the package:

composer require netdjw/lorem-ipsum

Update the config/app.php:

'providers' => [
    ...,
    App\Providers\RouteServiceProvider::class,
    
    // Our new package class
    netdjw\LoremIpsum\LoremIpsumServiceProvider::class,
],

Select the language seeder

Use this method in your database/seeds/DatabaseSeeder.php file (for latin language):

$this->call([
    'netdjw\LoremIpsum\Database\Seeds\LoremIpsumLaSeeder'
]);

Then run migration & seed:

php artisan migrate --seed

If you want to use a different language change this:

LoremIpsum[lang]Seeder.php

If you got an error on seeding then you need to create a CreateLoremIpsumTable migration. Use this command:

php artisan make:migration CreateLoremIpsumTable

Then find the migration file and fill with this content:

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLoremIpsumTable extends Migration
{
    /**
    * Run the migrations.
    *
    * @return void
    */
    public function up()
    {
        Schema::create('lorem_ipsum', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('lang', 2)->default('la');
            $table->string('word', 255)->default('');
        });
    }

    /**
    * Reverse the migrations.
    *
    * @return void
    */
    public function down()
    {
        Schema::dropIfExists('lorem_ipsum');
    }
}

Available languages

  • english (en)
  • hungarian (hu)
  • latin (la)

Use the package

use netdjw\LoremIpsum\Http\Controllers\LoremIpsumController as LoremIpsum;

// create new instance
$lipsum = new LoremIpsum();

// return 5 paragraphs latin plain text
return $lipsum->plainText('la', 5);

// return 3 praragraps english HTML text
return $lipsum->html('en', 3);

Thanks to

Based on this StackOverflow question

Thanks for the great starter code for mpen

  • English dictionary seeder from here
  • Hungarian dictionary seeder from here
  • Latin dictionary seeder from here

About

Lorem Ipsum generator for Laravel framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages