Download the PHP package reedware/laravel-seeders without Composer

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

Laravel Seeders

This package adds the ability to generate and seed from seed data.

Laravel Version Automated Tests Coding Standards Static Analysis Latest Stable Version

Introduction

Seeders in Laravel are great for seeding fake data, but that's not their only use case. Seeders are also often used for seeding the boilerplate application data used in glossary type tables (e.g. enumerables, drop-down options, etc.), or tables managed by developers (e.g. roles, permissions, etc.). However, when seeding boilerplate data, there can be a number of complications that arise over time. This package aims to provide seeding application data, and solves the following complications that come with it:

Installation

Composer

This package can be installed using composer:

Service Provider

This package uses auto-discovery to register its service provider. If you choose to manually register the provider, here's the full class path:

Facade

This package uses auto-discover to register its facade. If you choose to manually register the facade, here's the default binding:

If you wish to avoid using the facade, you can obtain the underlying instance through the IoC Container:

Usage

Basic Example

To create your first seeder, start by creating a new seeder like so:

In this example, the seeder will generate seed data from the permissions table (derived from the model), and order the line items by the name attribute. When the seeder is used to seed from the source data, it will match existing permissions by the name property, and update them accordingly.

Allowed Operations

By default, resource seeders will perform the following operations upon seeding:

In this operation mode, the seed data is considered to be the source of truth for the database table.

However, you can disable any of the operations like so:

Here are the effects of disabling each operation:

Soft Deletion

When a seeded model soft deletes, the behavior of the seeder changes in the following ways:

Hard Deletion

When a database record is being deleted, it may have foreign key associations that prevent its deletion. Deletion through seeding deletes through the model, rather than a database query, so that you can leverage the Model::deleting(...) event hook to remove or unlink any relationships that would prevent its deletion.

Primary Keys

By default, seeders do not respect or enforce primary keys. If you wish to generate and seed primary keys, you can enable them like so:

Column Mapping

If you want to change the generation ouput and the seeder intake, you can customize the following methods within your seeder:

Column Omission

If you want to prevent specific columns from being seeded, you can omit them in your resource seeder:

Environment Specific Behavior

The configuration options for each resource seeder has been shown using a property. If you want to have environment specific behavior, you won't be able to use properties to do that. Luckily, each property has a corresponding method that you can leverage instead:

Commands

To seed using a seeder from this package, you can call the traditional php artisan db:seed --class="MyDatabaseSeeder command.

To generate seed data based on table contents, you can call the new php artisan db:seed:generate --class="MyDatabaseSeeder command.

Data Storage

The data you want to seed into your application should be housed within your source code, and therefore maintained under version control. The location and format of the seed data is customizable if you aren't comfortable with the default configuration.

Root Path

By default, this package places your seed data within a new ~/database/seeders/data directory. If you wish to customize this location, you can tap into the Seed facade:

Model Mapping

This package uses your models as reference to the source tables, as it detected soft deletion, timestamp usage, and other features that are already configured by your models. Your model is also used to name the seed data file, by converting the model based name to plural snake case (e.g. "MyModel" becomes "my-models.csv").

If you wish to override a particular model, you can tap into the Seed facade:

Alternatively, if you wish to customize the default convention, you redefine it:

File Format

This package uses csv files as external storage, but you may prefer another format. You can override the file reader and writer to use whichever format you prefer:

Custom Reader:

Custom Writer:


All versions of laravel-seeders with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/console Version ^9.0|^10.0
illuminate/container Version ^9.0|^10.0
illuminate/database Version ^9.0|^10.0
illuminate/http Version ^9.0|^10.0
illuminate/support 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 reedware/laravel-seeders contains the following files

Loading the files please wait ....