Download the PHP package benmajor/redseed without Composer

On this page you can find all versions of the php package benmajor/redseed. 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 redseed

RedSeed

RedSeed is a database seeder for use with the popular (and amazing) RedBean ORM for PHP.

What is database seeding?

Database seeding is the initial seeding of a database with data. Seeding a database is a process in which an initial set of data is provided to a database when it is being installed. It is especially useful when we want to populate the database with data we want to develop in future. This is often an automated process that is executed upon the initial setup of an application. The data can be dummy data or necessary data such as an initial administrator account.

Incentive

Popular PHP ORMs support database seeding, and I found myself increasingly needing to do it while working with RedBean. Manually creating data for use inside an application which uses RedBean can be tedious, and often involves loops and other verbose code techniques to get the job done. As such, I decided that it would be worthwhile to build upon the great plugin architecture of RedBean, and following a discussion with the RB creators and devs, we agreed it should be started. It is my hope that this repo (and in turn the RedSeed project) will grow with time, and I would certainly recommend any feedback or suggestions from users. Please use Github Issues to file suggestions, comments or bug reports.

Installation

The easiest way to install RedSeed is to use Composer:

Once you have required the project via Composer, you must ensure that you include the autoload file inside of your project:

Alternatively, you can download the contents of the src/ directory, and include all of the files inside of your project. We do not recommend installing this way!

1. Usage:

RedSeed adds a new method to the R class of RedBean called seed. Below is an example of seeding 10 user beans with several fields defined:

This will create 10 user beans with the fields forename, surname and email, and returns an array containing the generated beans. RedSeed automatically adds a new field to the schema named _seeded, which is used when unseeding a table. Below is an example of how to unseed the user table:

Unseeding a table will delete any records that were created using the seed function, by analysing records whose _seeded property is set to 1. To avoid any data loss, do not modify the value of _seeded against other records in the table. Calling unseed will cause the _seeded column to be dropped from the schema.

2. Functions:

RedSeed includes a number of handy predefined functions that should be passed as the array value in the last argument of the seed function (see example above). In addition, it is also possible to pass in a lambda function that returns some value:

If a lambda function returns an array, its return value will be used for the bean's ownXList property! For example:

In the example above, 10 user beans will be created, each having two login objects assigned to its ownLoginList property.

Below is a table which lists the functions available to fields in RedSeed:

Function name Description Arguments Example
string Returns a random string (all lower case) of variable length (between min and max chars).
Return: aytwr.
min = int
max = int
string(3,10)
word Returns a random string with the first character in upper case of variable length (between min and max chars).
Return: Lotfsa.
min = int
max = int
word(5,10)
integer Generates a random integer between min and max
Return: 53.
min = int
max = int
integer(1,100)
time Returns the current time in ISO 8601 format.
Return: 10:16:53.
None time()
date Returns the current date in ISO 8601 format.
Return: 2020-08-16.
None date()
datetime Returns the current date-time in ISO 8601 format.
Return: 2020-08-16 10:16:53.
None datetime()
email Returns a random, verifiable email address.
Return: [email protected].
None email()
ipaddress Generates a random, verifiable IPv4 address.
Return: 174.68.10.79.
None ipaddress()

3. Contribute:

I would welcome any assistance and feedback in managing and developing RedSeed. There is an issue over on the RedBean GitHub repository regarding its discussion (https://github.com/gabordemooij/redbean/issues/837), but please keep use the RedSeed repository to post issues and comments about the plugin.

4. Roadmap:

I plan to add more methods and functionality to RedSeed in the coming weeks, at this stage, the project is a proof-of-concept. The following is a very rough roadmap of things I plan to implement:

License:

Copyright 2020 Ben Major.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


All versions of redseed with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
gabordemooij/redbean Version *
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 benmajor/redseed contains the following files

Loading the files please wait ....