PHPackages                             artoodetoo/so-example - 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. artoodetoo/so-example

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

artoodetoo/so-example
=====================

StackOverflow DB for Laravel

v0.1(6y ago)52[4 PRs](https://github.com/artoodetoo/so-example/pulls)MITPHPPHP ^7.2

Since Feb 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/artoodetoo/so-example)[ Packagist](https://packagist.org/packages/artoodetoo/so-example)[ RSS](/packages/artoodetoo-so-example/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (8)Versions (6)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/c3a93f17d1c8646522be8218c4b602390011b6ac9c1be64be042433b76d06893/68747470733a2f2f706f7365722e707567782e6f72672f6172746f6f6465746f6f2f736f2d6578616d706c652f762f737461626c65)](https://packagist.org/packages/artoodetoo/so-example)[![License](https://camo.githubusercontent.com/5611407c167b80ecf7a0cc25c22c3baeb74b16b1b3a551c7850b7ba54d47442d/68747470733a2f2f706f7365722e707567782e6f72672f6172746f6f6465746f6f2f736f2d6578616d706c652f6c6963656e7365)](https://packagist.org/packages/artoodetoo/so-example)

StackOverflow DB for Laravel
============================

[](#stackoverflow-db-for-laravel)

Introduction and Disclaimer
---------------------------

[](#introduction-and-disclaimer)

It won't be a S.O. clone in any meaning. My interest is to get big enough and close-to-real-world DB sandbox. And get it ready to Laravel Eloquent.

To be precise, it is the common structure of a several Q-n-A sites of StackExchange, not only stackeoverflow.com.
Please start from the awesome [Brent Ozar post](https://www.brentozar.com/archive/2015/10/how-to-download-the-stack-overflow-database-via-bittorrent/) to get more information about the topic.

Original DB is in *MS SQL* and dump is available in *XML*. Database has obfuscated private information and it's publicly available under [cc-by-sa](https://creativecommons.org/licenses/by-sa/4.0/) license.

My humble goal is *MySQL* database in Laravel standards. It will be a set of migrations, classes and console command to import DB dump and fill the gaps when required.
Since it is a one time action, *I DON'T try to do import as fast as possible.* I know, SQL can be much more effective than cycles on the PHP side. But that is.

*NOTE:*

> As of v0.1, the tables do not have indexes and foreign keys. It allows to import data fast but the queries are slow.
> Starting from v0.2, I have been working on data consistency and queries optimization, so there will be indexes and FKs in migrations.
>
> Feel free to run `git reset  --hard` or `git pull` to get this or that set of migrations *before* the import.

Laravelization
--------------

[](#laravelization)

Now all names are in snake\_case.
It is common to use `created_at` and `updated_at` names for timestamps, so I replaced original field names to these ones when applicable.
As for `users` table, I make it compatible with standard Laravel auth, so I added some fields.
I shorted a couple of super long names like `PostHistoryTypeId` =&gt; `history_type_id`.
To use unsigned big integer for primary and foreign keys, I have replaced special value of "-1" to "1".

Missing data
------------

[](#missing-data)

For privacy purposes, some fields are not mentioned in the dump. But they obviously required, like email and password. See my notes about `users` above.
`Votes` table miss the voting user reference. It is null in most cases (exceptions are bounties and favs), it looks pretty unreal and have to be filled by fake data.
`Posts` and `Tags` should be related as many-to-many. The pivot table is missing and the only source is denormalized field `posts`.`tags`.

Usage
-----

[](#usage)

### Installation

[](#installation)

```
composer create-project artoodetoo/so-structure
```

Then go to new project directory, set database parameters in the .env file and run

```
php artisan migrate
```

to create all the tables.

### Data Import and post-processing

[](#data-import-and-post-processing)

Download database dump from Web Archive site or via torrent. (you can find links in Brent's article)
Import tables content one by one:

```
php artisan stack:import path/to/Table.xml
```

Typically, for each site you have 8 files or tables to import:
`Users`, `Badges`, `Tags`, `Posts`, `Comments`, `Votes`, `PostLinks`, `PostHistory`.
The 9th table `post_tag` does not come out of the box. To recreate its data you have to run

```
php artisan stack:post-tag
```

Votes in the dump are anonymous. The only exception is favorite and bounty actions.
To attach acceptance and up/down votes to random users, call

```
php artisan stack:vote-users --action=accept
php artisan stack:vote-users --action=up-down
```

(These are very slow)

License
-------

[](#license)

StackOverflow DB for Laravel is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2280d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b982e008c16f8ed2e586e900267b93b01114c28edad839b80b2bad2f4cf1a15d?d=identicon)[artoodetoo](/maintainers/artoodetoo)

---

Top Contributors

[![artoodetoo](https://avatars.githubusercontent.com/u/577710?v=4)](https://github.com/artoodetoo "artoodetoo (15 commits)")

---

Tags

laravelprojectstackoverflow

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/artoodetoo-so-example/health.svg)

```
[![Health](https://phpackages.com/badges/artoodetoo-so-example/health.svg)](https://phpackages.com/packages/artoodetoo-so-example)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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