Download the PHP package maestroerror/statamic-magic-import without Composer
On this page you can find all versions of the php package maestroerror/statamic-magic-import. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maestroerror/statamic-magic-import
More information about maestroerror/statamic-magic-import
Files in maestroerror/statamic-magic-import
Package statamic-magic-import
Short Description Seamless, magical import experience for Statamic
License MIT
Informations about the package statamic-magic-import
Statamic Magic Import
your go-to solution for effortless data imports. With a user-friendly interface and support for JSON data formats, importing data into Statamic becomes as easy as a wave of a wand. Experience the magic of hassle-free data management
This addon can work with JSON files extracted using a statamic exporter Wordpress plugin.
Json import
JSON file examples:
Features
Json import:
- Create taxonomies and terms
- Create pages
- Create collections and entries
- includes fields choosing feature for importing in existing collections
Any meta data key prefixed with an underscore will be ignored.
Events
The addon is using the builtin methods for creating and saving content. As such, the normal events are dispatched which you can hook into for additional work according to your setup. That means you can listen on the following events to customize the import:
Statamic\Events\CollectionCreated
Statamic\Events\CollectionSaved
Statamic\Events\EntrySaving
Statamic\Events\EntryCreated
Statamic\Events\EntrySaved
Statamic\Events\TaxonomySaved
Statamic\Events\TermSaved
Statamic\Events\AssetSaved
Statamic\Events\AssetUploaded
By the time you read this there might be others. Consult the documentation to learn more.
Images
All URLs including image extensions (.png, .jpg, .webp and etc) will be downloaded. Featured images will be downloaded to the "assets" container by default (change in config), into a folder called "{collection_handle}/{entry_slug}", and saved in a assets field.
How to Install
You can search for this addon in the Tools > Addons
section of the Statamic control panel and click install, or run the following command from your project root:
How to Use
Go to the Tools > Magic Import
section and upload the json file.
For collections, the summary will show you 2 options: creating a new collection or importing in existing one.
When importing in existing collection, you can choose JSON field for each of your collection fields.
Even when creating new collection, there might be the collection with same name. If you choose to import it anyway, the content will be overwritten, but you can (De)Select anything you want (by titles) and click "Import".
Note: You might get timeout errors if you're importing large datasets and/or many images.
Config
The content of the config file looks like this:
You can publish configuration file using this command:
php artisan vendor:publish --tag=statamic-magic-import-config
You can publish other asset with the command:
php artisan vendor:publish --tag=statamic-magic-import
To Do
- Using JSON field twice skips the first field (Was using "title" from json in "title" and "header" in collection and collection's "title" field was empty)