dotunj/randomable

A package for generating random data

dev-master 2019-12-15 12:52 UTC

This package is auto-updated.

Last update: 2024-09-15 23:27:45 UTC


README

This is a Laravel package for generating random data such as first names, last names and emails.

Step One - Installation

Require the package via composer into your project

composer require dotunj/randomable

Step Two - Publishing Configurations

Randomable provides you with an easy way of customizing the table name for storing the random data. To customize this you need to publish the configuration file and edit the table name. To publish the configuration files, run:

php artisan vendor:publish --tag=randomable-config

This is the content of the config file that will be published at config/randomable.php

<?php
    return [
        'table_name' => 'randomables',
    ];

You can go ahead and customize the Table name as you find suitable before running the Migration.

Step Three - Publishing Migration and Seeds

Next, to publish the Migrations from the package

php artisan vendor:publish --tag=randomable-migrations

To publish the Seeders from the package

php artisan vendor:publish --tag=randomable-seeds

Step Four - Running Migrations

Make sure you've edited the .env file with your correct Database Credentials

php artisan migrate

Finally, run the Package seeders

php artisan db:seed --class=RandomableTableSeeder

Optionally to publish all of the package's resources at once, you can run the following command:

php artisan vendor:publish --provider="Dotunj\Randomable\RandomableServiceProvider"

Usage

To generate a random first name, last name and email, you can use the Facade at Dotunj\Randomable\Facades\RandomableFacade.

<?php

use Dotunj\Randomable\Facades\RandomableFacade as Randomable;

$firstName = Randomable::firstName();

$lastName = Randomable::lastName();

$email = Randomable::email();

Contributing

Want to contribute to this package? Read our contributor guidelines to get set up.

License

This package is released under the MIT License.