This package contains an extracted version of the Laravel 5 model factories, made compatible with Laravel 4 installations.
You can install this package through Composer:
composer require stidges/eloquent-factory
You can refer to the original Laravel documentation on how to use the model factories.