Download the PHP package tobento/service-seeder without Composer

On this page you can find all versions of the php package tobento/service-seeder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package service-seeder

Seeder Service

Generating fake data customized for your PHP application needs.

Table of Contents

Getting started

Add the latest version of the Seeder service project running this command.

Requirements

Highlights

Documentation

Do only use for seeding. It will not generate cryptographically secure string and numbers as it focuses more on speed.

Create Seed

Add Seeders

Add callable seeder

Add callable seeder using resource items

Seed

seeding

The Seed::class dynamically calls a seeder method to seed data. It throws a SeedMethodCallException if no seeder is found supporting the called method.

seeder

You may use the seeder method to return a seeder added.

resources

You may use the resources method to return the resources.

getItems

You may use the getItems method to return items of a specified resource. If multiple locales specified, it merges items.

Localization

seeding

Use the locale method before calling a seeder method to seed data from resources in the specific locale(s).

Random Seeding

You may use the random method before calling a seeder method to seed the specified value randomly by its probability percentage.

Seeders

Resource Seeder

The resource seeder provides handy methods to seed data using resource items. If no Lorem Seeder word(s) depending on methods.

Available methods

Method Parameters Description
itemFrom resource: 'countries' Returns a randomly selected item from the specified resource items.
itemsFrom resource: 'countries', number: 3, unique: true Returns randomly selected items from the specified resource items. If unique is set to true, it might return fewer items number as specified.

DateTime Seeder

The DateTime seeder provides handy methods to seed DateTime data. You may visit Dater Service for more detail on the DateFormatter::class.

Available methods

Method Parameters Description
dateTime from: '-30 years', to: 'now' Returns a date time object between the specified from and to date.
month from: 1, to: 12, pattern: 'MMMM' Returns a month between the specified from and to month formatted by pattern. Pattern: 'M' = '1', 'MM' = '09', 'MMM' = 'Jan', 'MMMM' = 'January'
weekday from: 1, to: 7, pattern: 'MMMM' Returns a weekday between the specified from and to weekday formatted by pattern. Pattern: E, EE, or EEE = 'Tue', 'EEEE' = 'Tuesday', 'EEEEE' = 'T', 'EEEEEE' = 'Tu'

User Seeder

The user seeder provides handy methods to seed user data. If no Lorem Seeder word(s) depending on methods.

Available methods

Method Parameters Resource(s) Used Description
firstnameFemale firstnamesFemale Returns a random female firstname.
firstnameMale firstnamesMale Returns a random male firstname.
firstname firstnamesFemale, firstnamesMale Returns a random firstname.
lastname lastnames Returns a random lastname.
fullnameFemale separator: ' ' firstnamesFemale, lastnames Returns a random female fullname.
fullnameMale separator: ' ' firstnamesMale, lastnames Returns a random male fullname.
fullname firstnamesFemale, firstnamesMale, lastnames Returns a random fullname.
firm firms Returns a random firm.
street withNumber: false streets Returns a random street.
postcode postcodes Returns a random postcode.
city cities Returns a random city.
country countries Returns a random country.
email from: null domains, firstnamesFemale, firstnamesMale, lastnames Returns a random email. It will create the email based on the from parameter if specified.
smartphone smartphones Returns a random smartphone number.
telephone telephones Returns a random telephone number.
password Returns a random password.

Create Custom Seeder

You may create a custom seeder for your application.

Resources

Create Resources

Add Resources

You may add resources by using the add method:

add resource

add resources

Filter Resources

You may use the filter methods returning a new instance.

filter

locale

locales

name

File Resource

You may use the file resource to load data from json or php files.

Supported files are json and php

json

php

Get Resources And Items

all

items

:warning: You must call locale() or locales() before all() or items() method if you have added (sub or lazy) resources, otherwise they will not get loaded.

Files Resources

You may use the files resources to load resource data from a directory.

Create Files Resources

Directory Structure

Supported Files

Currently supported files are json and php.

json

php

Supporting Other Files

You may support others files by providing your own resource factory:

Static Seeders

Str Seeder

Available methods

Method Parameters Description
string length: 15, chars: 'abc123' Generates a random string. If char parameter is specified it only uses those for generation.
length min: 1, max: 8, chars: 'abc123' Generates a random string between the min and max length with the chars specified.
replace string: 'pattern', with: [] Returns the string replaced with the parameters specified.

replace

Lorem Seeder

Available methods

Method Parameters Description
word number: 10, separator: ' ' Generates a random lorem word(s) in lowercase.
words minWords: 1, maxWords: 10, separator: ' ' Generates a random lorem words between the min and max words specified in lowercase.
sentence number: 10 Generates a random sentence(s).
slug minWords: 1, maxWords: 10 Generates a random slug between the min and max words specified.

Num Seeder

Available methods

Method Parameters Description
bool Generates a random bool.
int min: 1, max: 1000 Generates a random int between the min and max specified.
float min: 1.5, max: 55.5 Generates a random float between the min and max specified.
price min: 5, max: 80, precision: 0, step: 0.05 Generates a random price between the min and max specified. If the precision parameter is not null, it rounds to the optional number of decimal digits. Use the step parameter for rounding in step.

Json Seeder

Available methods

Method Parameters Description
encode items: [] Encodes the specified items to a json string.
decode string: '' Decodes the specified string to an array.

Arr Seeder

Available methods

Method Parameters Description
item items: [] Randomly selects an item value from the items.
items items: [], number: 3, unique: true Randomly selects items value from the items. If unique is set to true, it might return fewer items number as specified.

Credits


All versions of service-seeder with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
tobento/service-filesystem Version ^1.0
tobento/service-dir Version ^1.0
tobento/service-dater Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tobento/service-seeder contains the following files

Loading the files please wait ....