Download the PHP package lionelkouame/sylius-import-export-plugin without Composer

On this page you can find all versions of the php package lionelkouame/sylius-import-export-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sylius-import-export-plugin

FOSSyliusImportExportPlugin

Installation

  1. Require relevant portphp format support

    • Run composer require portphp/csv --no-update to add CSV format support
    • Run composer require portphp/spreadsheet --no-update to add Excel format support (also install the zip PHP extension)
  2. Require and install the plugin

    • Run composer require friendsofsylius/sylius-import-export-plugin
  3. Register the bundle:

Configuration

Application configuration:

Routing configuration (only necessary if web_ui is set to true):

Message queue configuration

Any library implementing the "queue-interop/queue-interop" can be used as the message queue. Following is the "enqueue/redis" library shown as an example usage.

Usage

Available importer types

Available exporter types

Example import files

See the fixtures in the Behat tests: tests/Behat/Resources/fixtures

UI

For all available importers, a form to upload files is automatically injected into the relevant admin overview panel using the event hook system, ie. admin/tax-categories/.

CLI commands

Development

Adding new importer types

Notes

Adding a ResourceImporter

Define Importer-Service for Generic Importer in services_bar.yml with ResourceImporter
Alternatively implement a custom ResourceImporter FooImporter
Define service instead of the above mentioned

Adding a ResourceProcessor

Define processor service with generic ResourceProcessor in services.yml

HeaderKey0 is the key that will be searched for in the Database, to avoid redundancy. So best would be to make HeaderKey0 a unique Key.

The fourth parameter represents the Headers of the data to import. For csv-files this would be the headers defined in its first line. These HeaderKeys have to be equal to the fields in the resource to import if the generic ResourceProcessor is used, since the Keys are used for building dynamic Methodnames

Alternatively implement a custom ResourceProcessor FooProcessor
Define processor service with FooProcessor in services.yml instead of the above mentioned generic one

Validating Metadata

Each Processor has defined mandatory 'HeaderKeys'. For basic validation of these HeaderKeys you can use "@sylius.importer.metadata_validator". Of course it is also possible to implement you own Validator, by implementing the MetadataValidatorInterface and injecting it in your FooProcessor instead of the generic one.

Defining new Exporters

Notes

Exporters

Adding a ResourceExporter

Define your ResourceExporter in services_bar.yml (at the moment only csv is supported for export)

Note that app.foo is the alias as you have named your resource:

Define the PluginPool for your ResourceExporter in services.yml

Define the Plugin for your FooResource in services.yml

In case you want to use the grid filters (in the admin) to filter your output, add to your routing:

And add the associated controller service definition to your services

In case you don't add it, the UI exporters will still function. They will simply load all data of that resource for the export (similar as CLI).

A real example

Define the Countries-Exporter in services_csv.yml

Define the PluginPool for the Countries-Exporter in services.yml

Define the Plugin for the Country-Resource in services.yml

The exporter will instantly be available as a exporter for the command line.

$ bin/console sylius:export country my/countries/export/csv/file.csv --format=csv

Optional add the routing:

And add the associated controller service definition to your services

PluginPool

The idea behind the plugin pool is, to be able to have different kind of plugins, which could possibly provide data based on a custom sql that queries additional data for the exported resource, such as the preferred brand of a customer. At the moment there are only 'ResourcePlugin's, which allow the complete export of all data of one resource at the moment. With the provided keys you can influence which fields of a resource are exported.

Running plugin tests

Opening Sylius with your plugin

Fixture file with login information: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/CoreBundle/Resources/config/app/fixtures.yml


All versions of sylius-import-export-plugin with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.0
sylius/sylius Version ~1.8.0 || ~1.9.0 || ~1.10.0 || ~v1.11.0
portphp/portphp Version ^1.2
symfony/stopwatch Version ^4.4 || ^5.2
queue-interop/queue-interop Version ^0.6.2 || ^0.7 || ^0.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lionelkouame/sylius-import-export-plugin contains the following files

Loading the files please wait ....