Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Xporter Bundle

Xporter Bundle Laravel Package

aquis/xporter-bundle

View on GitHub
Deep Wiki
Context7

Bundle allowing to export and import back from your DB, fixtures in yml format.

Frequently asked questions about Xporter Bundle
Can I use Aquis Xporter Bundle directly in a Laravel project?
No, this bundle is designed for Symfony and requires custom integration. You’ll need to create a Laravel service provider or Artisan commands to bridge the gap between Symfony’s Doctrine ORM and Laravel’s Eloquent. Consider wrapping the core YAML logic in a standalone PHP library for easier adoption.
What Laravel versions does this bundle support?
The bundle itself doesn’t support Laravel natively, but you can adapt it for Laravel 8.x–10.x by building a wrapper layer. Test compatibility with Eloquent’s query builder and Artisan CLI, as Symfony’s Console commands won’t work out-of-the-box.
How do I export Eloquent models to YAML format?
Use Eloquent’s `toArray()` method to convert models to arrays, then serialize with `symfony/yaml` (e.g., `Yaml::dump($data)`). For a full solution, create an Artisan command that iterates over models and writes YAML files. Example: `$yaml = Yaml::dump(Model::all()->toArray());`
Does this bundle handle relationships like hasMany or belongsTo?
No, relationship handling isn’t built-in. You’ll need to manually resolve relationships in your wrapper layer or use Eloquent’s `with()` method before exporting. For imports, ensure `fillable` attributes are set and handle mass assignment risks.
Is YAML the best format for large datasets in Laravel?
YAML is verbose and slower to parse than JSON or CSV for large exports. For performance, consider `spatie/laravel-data-exporter` (CSV/JSON) or optimize with `spatie/array-to-xml` for YAML. Test memory usage—loading entire DB schemas may cause out-of-memory errors.
How do I import YAML fixtures back into Laravel?
Parse YAML with `Yaml::parse()`, then use Eloquent’s `create()` or `insert()` methods. Handle `fillable`/`guarded` attributes and relationships manually. For complex cases, build a custom seeder or use `laravel-shift/database-dumper` for bulk imports.
Are there Laravel-native alternatives to this bundle?
Yes. For exports, try `spatie/laravel-data-exporter` (CSV/JSON) or `laravel-shift/database-dumper`. For imports, use `spatie/laravel-data-importer` or custom seeders with YAML parsing. These avoid Symfony dependencies entirely.
How do I handle circular references in YAML exports?
Circular references (e.g., bidirectional relationships) aren’t natively supported. Flatten data manually or use Eloquent’s `with()` to eager-load relationships, then serialize. For imports, validate data structure to avoid infinite loops during hydration.
Can I use this bundle for production database backups?
No, this bundle isn’t designed for production backups. YAML is inefficient for large datasets, lacks compression, and may fail with complex schemas. Use `laravel-shift/database-dumper` or `spatie/laravel-backup` for production-grade backups.
What’s the best way to test YAML exports/imports in Laravel?
Test exports by comparing YAML output to expected arrays. For imports, use Laravel’s `assertDatabaseHas()` or mock Eloquent models. Test edge cases like empty datasets, special characters, and relationship conflicts. Use `symfony/yaml` for parsing and `fakerphp/faker` to generate test data.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware