Download the PHP package bluekachina/seedfromjson without Composer

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

SeedFromJSON

Seed Your Database Using JSON files

This package makes it easy to have your DB seeded from JSON files. JSON files are expected to be named like the tables they contain the data for. This library was created mainly because of how easy it is to create JSON files from within the PHPStorm IDE

It supports PHP 7.3+

Installation

Require this package with composer using the following command:

Configuration

Publish the configuration for this package

|| ToDo: There's probably a more specific command you can use. I think you would need to name this package specifically.

Storage Setup

Create a disk in your config/filessystems.php file. Disks probably already exist for local, public, s3, etc... The name of the disk you create should match what is named within the config (default is seed_content)

Usage

1) Create at least one JSON file within your seed_content folder 2) Make use of this library from within one of your Laravel project's DatabaseSeeder.php file. 3) Run php artisan migrate --seed

Examples

This library is registered as a singleton and so should be invoked using app(SeedFromJSON::class).

Step 1: Populate your seeding queue

Often times your tables will need to be populated in a specific sequence. Because of that, we make use of a queue so that you can still be in charge of that sequence. Simply add a new model to the seeding queue for each of the model/tables you want to populate

The method is defined with the following signature:

An example usage would be:

Step 3: Begin seeding

Seeding takes place based on all the queued items that were just added

Quick Seeding

Quick seeding is enabled via config/env variable. See published config file By. By defaultg, quick seeding is enabled only in local environments

When enabled, seeding imports a limited number of records (First x records from JSON). The number of records (x) is also determined by config/env variable, and defaults to 100

Options

Many different options have been made available.
Each can be specified on a table-by-table basis, and since they're bitwise options, multiple can be used at a time (separated by |).

Advanced Use

The beginSeeding function takes an optional parameter that determines whether or not seeding is actually ready to commence

Example

ExampleModelSeeder.php

Notice that we are including an optional parameter into the run function, and then handing that off to the beginSeeding function. This is what allows us to process the seeding both as an individual seeder AND as part of a batch.

In order to take advantage of this as part of a batch you can do something like the following: DatabaseSeeder.php

Here we're telling all of the individual calls to defer. Once they're all done, we invoke beginSeeding without deferring.


All versions of seedfromjson with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3.0
ext-json Version *
halaxa/json-machine Version ^1.1
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 bluekachina/seedfromjson contains the following files

Loading the files please wait ....