Download the PHP package windinternet/randomdata without Composer
On this page you can find all versions of the php package windinternet/randomdata. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download windinternet/randomdata
More information about windinternet/randomdata
Files in windinternet/randomdata
Package randomdata
Short Description TYPO3 extensions to generate new random data or replace existing data with random data
License GPL-3.0-or-later
Informations about the package randomdata
TYPO3 Extension randomdata
TYPO3 extensions to generate new random data or replace existing data with random data
This extensions uses https://github.com/FakerPHP/Faker and was inspired by https://github.com/georgringer/faker. Thanks go out to the builders, contributors and maintainers of those projects.
Requirements
- TYPO3 CMS 9.5, 10.4 or 11.5
- PHP 7.2+
- Licence: GPL 3.0
Manual
After installing randomdata in TYPO3 you can run it using the following command:
For more information about the command line options, use the following command:
The location of the configuration yaml file needs to be inside the site root.
For each record type you want to add to a PID you have to add configuration to the yaml file. The configuration for a single record type in a single pid looks like this:
- recordTypeName is just a label. It can be anything you want. For example
news
- table is the database table for the record. This table has to be known in TCA. For example
tx_news_domain_model_news
- pid is the UID of the page for the record. For example
4
- action is the action to perform. By default only 2 actions are possible:
insert
to create new records andreplace
to replace all existing records of this type for that pid. It is also possible to create custom actions. - count is the number of records to create. This is only needed for the action
insert
. For example10
- fields contains the configuration for the fields of the records.
- field1 is the name of a field of the record. For example
title
- provider is the name of the Provider to use when generating the random data. For example
Words
.
A lot of Providers also require additional configuration. These can be placed on the same level as the Provider.
Providers
The following providers are available by default:
- Barcode
- type: The type of barcode [aen13 (default), aen8, isbn10, isbn13]
- Boolean
- City
- Color
- type: The type of color [hexColor (default), rgbColor, rgbCssColor, colorName, safeColorName]
- Company
- CountryCode
- Country
- CreditcardExpirationDate
- CreditcardNumber
- CreditcardType
- CurrencyCode
- DateTime
- minimum: The minimum date in any valid date/time format
- maximum: The maximum date in any valid date/time format
- timezone: The timezone
- format: The format as set for the PHP date() function
- Domain
- type: The type of domain [domainName (default), safeEmailDomain, freeEmailDomain, tld]
- Email
- type: The type of e-mail address [email (default), safeEmail, freeEmail, companyEmail]
- Emoji
- FieldDateTime
- field: The DateTime field to base this date/time on
- fieldFormat: The format as set for the DateTime field
- interval: The interval in any valid date/time format
- timezone: The timezone
- format: The format as set for the PHP date() function
- FileExtension
- File
- minimum: Minimum number
- maximum: Maximum number
- source: Source directory containing files
- referenceFields: Fields in the file reference
- FirstName
- gender: Gender of the name [null (default), male, female]
- FixedValue
- value: The value
- Float
- minimum: Minimum number
- maximum: Maximum number
- decimals: Maximum number of decimals
- FullAddress
- Hash
- type: Type of the hash [sha1 (default), sha256, md5]
- Iban
- country: Country for the Iban
- Integer
- minimum: Minimum number
- maximum: Maximum number
- Ip
- type: The type of IP address [ipv4 (default), ipv6, localIpv4]
- JobTitle
- LanguageCode
- LastName
- Locale
- MimeType
- Name
- gender: The gender of the name [null (default), male, female]
- addTitle: Add a title to the name [false (default), true]
- Paragraphs
- minimum: The minimum number of paragraphs
- maximum: The maximum number of paragraphs
- sentences: The approximate number of sentences (could be a few more or less randomly)
- html: Run through htmlSpecialChars and add
<p>
and</p>
tags [false (default), true]
- PhoneNumber
- e164: The phone number should be in e164 format [false (default), true]
- Postcode
- RandomValue
- values: Array of values
- Relation
- table: The table to select the relation from
- pid: The pid to select the relation from
- minimum: The minumum number
- maximum: The maximum number
- Sentences
- minimum: The minimum number
- maximum: The maximum number
- State
- StreetAddress
- Street
- SwiftBic
- Text
- maximum: The maximum number
- Title
- gender [null (default), male, female]
- Url
- UserAgent
- type: The browser type [null (default), chrome, firefox, safari, opera]
- Uuid
- Words
- minimum: The minimum number
- maximum: The maximum number
Example configuration yaml
Custom Provider
You can create a custom provider from your own extension by adding a class which implements \WIND\Randomdata\Provider\ProviderInterface
. It should have at least a static generate
method.
You can set your custom provider in the configuration yaml file by setting the full class name in the provider
option. For example provider: \My\Custom\Provider
Custom action
If you need anything other than insert
or replace
as action, you can use the generateItemCustomAction
signal slot. You also need to set your action in the $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['randomdata']['allowedActions']
array.