Download the PHP package littlegiant/silverstripe-seeder without Composer
On this page you can find all versions of the php package littlegiant/silverstripe-seeder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download littlegiant/silverstripe-seeder
More information about littlegiant/silverstripe-seeder
Files in littlegiant/silverstripe-seeder
Package silverstripe-seeder
Short Description Seed data objects for dev
License MIT
Homepage http://github.com/Little-Giant/silverstripe-seeder
Informations about the package silverstripe-seeder
SilverStripe Seeder
Sick of testing pagination by setting page length to 1 and making two data objects? Look no further!
Features
- Declarative method of generating test data
- Easy to way to share data dependencies with other developers
- Easy to extend
Installation
Installation via composer
How to use
Add to your configuration
Change to project root and run
Command line options
Option | Description |
---|---|
--force |
run the seeder ignoring current records |
--key |
only (un)seed records matching this key |
--class |
only seed records for this root class |
flush |
useful silverstripe CliController arg that flushes configuration |
Providers
Providers are a simple way to customise what data is generated. The seeder comes with a bunch of useful providers
Provider | Description | Example |
---|---|---|
ValueProvider | Use the given value, select variables included | Field: 'this is the value' |
DateProvider | Generate a date | Field: date(+3 months) |
FakerProvider | Generate data using the php faker library | Field: faker(sentences,3) |
FirstObjectProvider | Returns the first instance of the class | Parent: first(Page) |
RandomObjectProvider | Returns a list of random objects for class | Children: random(Page) |
HTMLProvider | Returns random HTML | Field: html() |
ImageProvider | Returns an Image of a placehold.it image |
Image: image(300,400) |
MemberProvider | Returns a member with email and password | Member: member([email protected],password) |
WhereProvider | Returns a DataObject with matching field value | Parent: where(Page, URLSegment, i-am-a-parent) |
Check here for more information on creating providers
Example
License
The MIT License (MIT)
Copyright (c) 2015 Little Giant Design Ltd
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.
Contributing
Pull requests are welcome
Code guidelines
This project follows the standards defined in:
All versions of silverstripe-seeder with dependencies
fzaninotto/faker Version ^1.5
symfony/console Version ^2.7
littlegiant/silverstripe-batchwrite Version ~0.3.0