Iseed for Lumen (No Need to Replace Composer Files)

Hello, My Developer Friends, I write this article, because of having the same issue when I was developing one of my company projects. I was using lumen for the API of that project and There were so many issues with it because It’s just a part of the whole Laravel system. By the way, it is so cool framework to build APIs as we wish. If you need a better speed, then you must choose Lumen instead of Laravel.

However, Iseed is a super package to use in the production level. If you need to migrate your database while you are in the production environment, you can export every record on tables you need to have. But the problem is, It’s based on Laravel. Yeah! We are talking about Lumen.

Refer this to Get an Idea about Laravel Inverse Seed Package.

As all of you know, some of the Laravel packages support for lumen projects. But some of them don’t directly. But if you can try some changes, then you will say It’s possible to use any type of Laravel package in Lumen. However, Let’s see how to use Iseed on Lumen.

1. Install Iseed on Composer.

composer require orangehill/iseed

2. Ad the following class on “bootstrap/app.php” file.

Orangehill\Iseed\IseedServiceProvider::class,

After doing all the configurations, you will get a booting error when you run the following command which is using to run Iseed.

php artisan iseed your_table_name

Don’t worry about it much. It’s time to do your magic. We won’t replace any core files of Iseed in the vendor folder. If you want, yes you can do it also. I will teach you both methods. But, I recommend the first one.

1st Method

1. Download this Iseed-lumen-fixed files and Extract it to this path. (App\Providers\Iseed)

 

2. Then you have to edit the class you provided before on the “bootstrap/app.php” file.

$app->register(App\Providers\Iseed\IseedServiceProvider::class);

3. Now all are fixed. You can run the seed command as I did before and experience the package.

 

2nd Method

Without changing the Bootstrap\App path, you can download the zipped file here and extract it to the following location and relace two files called IseedServiceProvider and IseedCommand.

vendor\orangehill\iseed\src\Orangehill\Iseed

I got a few hours to solve this and I hope, you will save that time. Thank you for being with KDJ Guru. Stay safe.