Download the PHP package kdabrow/seeder-once without Composer

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

GitHub Workflow Status (branch) Packagist Version Packagist Downloads Scrutinizer code quality (GitHub/Bitbucket)

Laravel Seeder Once

This library allows you to run your Laravel seeders only once.
No matter how many times artisan command db:seed is called. Done seeders will never be executed again.

How it works

Works similarly to migrations. First creates table in database, then logs all seeds that extend abstract class Kdabrow\SeederOnce\SeederOnce. In nutshell this will prevent to execute method run() if was executed in the past. Mechanism of logging data into database is heavily inspired by Laravel migration mechanism from package illuminate/database.

How to use it

1. Install it

By composer:

php laravel / lumen seeder-once
8.2, 8.3, 8.4 12.0
8.2, 8.3 10.0, 11.0
8.1, 8.2 10.0
8.0, 8.1 9.21
7.3, 7.4, 8.0 8.0, 9.0
7.2, 7.3, 7.4, 8.0 6.0, 7.0

In Lumen do not forget to register provider in bootstrap/app.php

2. Create seeders table in database

Use this command:

This step is optional. Trait SeederOnce detects if table exists. If not, creates it automatically.

3. Extend seeders that you want to be run only once with SeederOnce

So result should look like this:

This prevents to seed class SomeSeeder if was already seeded before.
Tip: Always replace class Seeder with SeederOnce. Otherwise, db:seed command might print unexpected results.

Configuration

Run seeder many times

It is possible to overwrite default functionality by change parameter $seedOnce to false:

Such seeder will run like normal laravel seeder (as many times as called).

Configuration file

It is possible to publish configuration file:

Table name

Default table name is: seeders

Console output

By default, seeder-once changes output of db:seed console command. Seeders that were run in the past will not be printed in the command output. It's possible to change that behaviour in configuration or by env variable:

Output for already run seeders looks like this:


All versions of seeder-once with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2.0
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.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 kdabrow/seeder-once contains the following files

Loading the files please wait ....