PHPackages                             capsulescodes/laravel-population - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. capsulescodes/laravel-population

ActiveLibrary[Database &amp; ORM](/categories/database)

capsulescodes/laravel-population
================================

Simplify database migrations and ensure consistency with your database tables effortlessly.

v3.0.10(1mo ago)374801MITPHPPHP ^8.3.0

Since Oct 23Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/capsulescodes/laravel-population)[ Packagist](https://packagist.org/packages/capsulescodes/laravel-population)[ RSS](/packages/capsulescodes-laravel-population/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (12)Versions (27)Used By (0)

[![Laravel Population](art/capsules-laravel-population-image.png)](art/capsules-laravel-population-image.png)

Simplify database migrations and ensure consistency with your database tables effortlessly.

Laravel Population package provides a set of commands that parses your migrations and detects any disparities between them and your database tables. If differences are found, a wizard is triggered to help you migrate and seed the new tables with converted records.

Typically, your `users` table might have a `name` column, but you need two separate columns : `first_name` and `last_name`. However, your database is already full of records.

[This article](https://capsules.codes/en/blog/fyi/en-fyi-modify-tables-and-records-with-laravel-population) provides an in-depth exploration of the package.

Warning

We recommend exercising caution when using this package on production.

Installation
------------

[](#installation)

```
composer require --dev capsulescodes/laravel-population
```

Usage
-----

[](#usage)

Let's say, your current `users` table have a `name` column, but you need two separate columns : `first_name` and `last_name`. First, modify your migration :

```
...
Schema::create( 'users', function( Blueprint $table )
{
    $table->id();
-    $table->string( 'name' );
+    $table->string( 'first_name' );
+    $table->string( 'last_name' );
} );
...
```

Now unleash the magic :

```
php artisan populate
```

The populate command will display the changes made in the migration files and ask for confirmation.

```
   INFO  Migration changes :

  create_users_table .......................................................................................................................... DONE

   INFO  Table 'users' has changes.

  ⇂ delete column : 'name' => type : varchar
  ⇂ create column : 'first_name' => type : varchar
  ⇂ create column : 'last_name' => type : varchar

 ┌ Do you want to proceed on populating the 'users' table? ─────┐
 │ Yes                                                          │
 └──────────────────────────────────────────────────────────────┘

 ┌ How would you like to convert the records for the column 'first_name' of type 'varchar'?  'fn( $attribute, $model ) => $attribute' ┐
 │ fn( $a, $b ) => explode( ' ', $b->name )[ 0 ]                                                                                      │
 └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

 ┌ How would you like to convert the records for the column 'last_name' of type 'varchar'?  'fn( $attribute, $model ) => $attribute' ┐
 │ fn( $a, $b ) => explode( ' ', $b->name )[ 1 ]                                                                                     │
 └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

   INFO  Population succeeded.
```

Your `users` table has been updated and seeded with converted records. Simple.

```
App\Models\User
{
    id: 1,
-    name: "Louie Wolff",
+    first_name: "Louie",
+    last_name: "Wolff",
},
App\Models\User
{
    id: 2,
-    name: "Holly Waters",
+    first_name: "Holly",
+    last_name: "Waters",
},
App\Models\User
{
    id: 3,
-    name: "Colton Mueller",
+    first_name: "Colton",
+    last_name: "Mueller",
},
...
```

```
# The populator will ask you the formula to convert existing records
'fn( $attribute, $model ) => $attribute'

# The inital representation of the parameters
$attribute = 'name'
$model = '$user'

# But you can decide to use any Laravel helpers instead
'fn() => fake()->firstName()'
```

If you want to rollback the latest population :

```
php artisan populate:rollback
```

```
   WARN  The rollback command will only set back the latest copy of your database(s). You'll have to modify your migrations and models manually.

   INFO  Database dump successfully reloaded.
```

Options
-------

[](#options)

```
php artisan populate --path={path-to-migrations-to-populate} --realpath={true|false} --database={database-name}
```

- Laravel Population supports SQLite, MySQL, MariaDB and PostgreSQL.
- Laravel Population can work with multiple databases.
- Laravel Population supports both anonymous and named migrations classes.
- Laravel Population supports multiple table creation in migration files.

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate. In order to run MySQL tests, credentials have to be configured in the intended TestCases.

Credits
-------

[](#credits)

[Capsules Codes](https://github.com/capsulescodes)

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance94

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Recently: every ~29 days

Total

26

Last Release

31d ago

Major Versions

v1.2.5 → v2.0.02025-03-03

v2.0.5 → v3.0.02025-09-01

PHP version history (3 changes)v1.1.0PHP ^8.2

v1.2.0PHP ^8.2.0

v3.0.0PHP ^8.3.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/102695023?v=4)[Capsules Codes](/maintainers/capsulescodes)[@capsulescodes](https://github.com/capsulescodes)

---

Top Contributors

[![mho22](https://avatars.githubusercontent.com/u/17177411?v=4)](https://github.com/mho22 "mho22 (47 commits)")

---

Tags

laravelmigrationpopulationlaravelmigrationspopulation

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/capsulescodes-laravel-population/health.svg)

```
[![Health](https://phpackages.com/badges/capsulescodes-laravel-population/health.svg)](https://phpackages.com/packages/capsulescodes-laravel-population)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136406.3k14](/packages/rector-rector-src)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

244226.1k2](/packages/dragon-code-laravel-deploy-operations)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

9410.7k](/packages/ahmed-bhs-doctrine-doctor)[nunomaduro/laravel-optimize-database

Publishes migrations that make your database production ready.

26548.7k](/packages/nunomaduro-laravel-optimize-database)[orptech/laravel-migration-partition

Laravel extensions that extends Illuminate to enable partitioned table creation within Laravel migrations.

3829.0k](/packages/orptech-laravel-migration-partition)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
