Download the PHP package faulker/eloquent-export without Composer
On this page you can find all versions of the php package faulker/eloquent-export. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package eloquent-export
Laravel Eloquent Export Tool
Give the ability to build profiles/configurations to be used by a artisan command to export data from the database using Eloquent models.
This has only been tested on Laravel 5.1 but it should work on higher versions
Use case:
- Export a user and all there data from a production database and import it into a local database for bug testing/repairing.
- Backup subset of data so that you can easily restore it after testing new features or changes to the data stored in the database.
Composer Install
Add the fallowing to your composer.json
Add the service provider to config/app.php
Publish the default config file config/eloquent-export.php
5.1 Notes
Laravel 5.1 dosen't support the ability of getting a list of a Model's casted columns so you will have to add the Faulker\EloquentExport\EloquentExportTrait
trait to any Model that has JSON
or array
casted columns.
Profile Creation
Profile Structure
Example
The above profile will export a user, all their posts, and all comments for each post.
Usage
Base arguments
- [profile] - Name of a profile you have created in the
config/eloquent-export.php
file. - [path_to_file] - Export/Import file.
- [--id=] - Primary ID ($primaryKey) of the root model data you want to export. Exp. if you are exporting a user then it would be the user's ID.
- [--import] - Import the data, if not set then data will be exported from the database.
Example Usage
Export using the user_posts
profile:
- The output file is in JSON format
Import using the user_posts
profile:
All versions of eloquent-export with dependencies
illuminate/database Version ~5
illuminate/config Version ~5
nesbot/carbon Version ~1.18