Download the PHP package offline/oc-seeder-plugin without Composer

On this page you can find all versions of the php package offline/oc-seeder-plugin. 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 oc-seeder-plugin

oc-seeder-plugin

Laravel Seeder integration for October CMS.

This plugin integrates Laravel's Factory and Database Seeder features with October CMS.

Installation

  1. Install the plugin using Composer.

  2. Setup the random file helpers.

Defining factories

To define a new Factory for your plugin, create a YourModelFactory.php in the plugin's factories folder and define your factories as you would in Laravel:

Next, add the OFFLINE\Seeder\Traits\HasSeederFactory trait to your model:

Defining seeders

Add a registerSeeder method to your Plugin.php in which you seed your plugin's models:

Tailor integration

Starting from version 2.1, this plugin can be used to seed Tailor data.

Requirements

To seed Tailor data using this plugin, it is required that all Tailor blueprint handles are in the SomeSection\SomeEntity format, like Blog\Post.

Defining factories

For a Tailor entity like Blog\Post, create the file app/factories/blog/PostFactory.php and define your factory in it.

Registering seeders

In the app/Provider.php, add a static registerSeeder method and define your seeders like so:

Seeding specific blueprints

The --plugins flag can be used to seed specific entities:

Migrate from 2.x

October 3.3 introduced its own plugin:seed Artisan command. To resolve this conflict, the Artisan command of this plugin was renamed to offline:seeder.

No special migration work is required, you can just use the new Artisan command.

Migrate from 1.x

To migrate old seeders from Version 1.0 of this plugin, make the following changes:

  1. Move all factories from the factories.php to their own Factory classes in the factories directory.
  2. Add the OFFLINE\Seeder\Traits\HasSeederFactory trait to all models
  3. Change your registerSeeder method:

Running seeders

Simply run php artisan offline:seeder to run the seeders of all plugins. The seeder of each plugin will be only run once.

To run a seeder for a already seeded plugin, use the --fresh option. Be aware that this will rollback and reinstall all plugins with a registered seeder completely, so any plugin data will be lost.

You can use the --plugins option to run only specified seeders. Simply provide a comma-separated list of plugin names.

Included factories

This plugin includes factories for the following models:

\System\Models\File::class

\System\Models\File::factory()->make() returns a File model with a random image. You can use it in any seeder to attach a file to a created model:

There are size states available: tiny returns a 90x90 image, hd returns a 1920x1080 image and huge returns a 6000x4000 image. Only one side of the image will match the given dimension (it is uncropped by default).

If you need something other than an image, you can use the file, pdf, mp3 or xlsx states:

\Backend\Models\User::class

\Backend\Models\User::factory()->make() returns a Backend User model. You can use the superuser state to generate a superuser.

\RainLab\User\Models\User::class

\RainLab\User\Models\User::factory()->make() returns a RainLab User model.

Twig helper functions

You can use the random_image() helper function to get a random image directly in your markup.

If you need a valid file download, you can use the random_file() function:

Attribution

All images used in this plugin are provided by unsplash.com.

Credits

This plugin is heavily inspired by Inetis' oc-testing-plugin.


All versions of oc-seeder-plugin with dependencies

PHP Build Version
Package Version
Requires composer/installers Version ~1.0
php Version >=7.2
fakerphp/faker Version ^1.9.1
laravel/framework Version ^9.0|^10.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 offline/oc-seeder-plugin contains the following files

Loading the files please wait ....