Download the PHP package basecom/sw6-fixtures-plugin without Composer

On this page you can find all versions of the php package basecom/sw6-fixtures-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 sw6-fixtures-plugin

Fixture Plugin

The fixture plugin is really helpful if you want to create some static demo data for your shopware instance.

Installation

Just add it to your project via composer:

Afterwards you can install the plugin, like any other Shopware Plugin using the administration or console command:

PHP & Shopware compatibility

Please use the following table to check which version can be used for your PHP and shopware version

Shopware Version PHP Versions Newest FixturePlugin version Supported
6.6.* v8.2, v8.3 v3.0.*
6.5.* v8.2, v8.3 v3.0.*
6.5.* v8.1 v2.0.*
6.4.* v8.1, v8.2 v2.0.*
6.3.* v8.1, v8.2 v2.0.*

Create Fixtures

Basic Fixture

Create a new file in the specific folder of your project for the fixtures and extend this file from abstract class "Fixture" in the library.

Then just implement the "load()" method with fixture logic.

Priority and Dependency

You can also add an optional priority or dependency of other Fixture classes via the corresponding "dependsOn()" or "priority()" method.

Groups

If you want to run specific fixtures as a group later, implement the "groups()" method from the abstact class and return an array of strings as group names.

Register Fixtures

If you're using service autowiring, then nothing needs to be done to register your fixtures. If you're not using autowiring, then please register your fixtures with the tag basecom.fixture.

Running Fixtures

Run all fixtures

To run all registered fixtures, just use this command.

Run single fixture

To run a single fixture, use this command with your fixture name as parameter.

By default, if you run a single fixture it will ignore all its dependencies. If you want to run the single fixture, including all dependencies recursively, use the --with-dependencies option.

Run group

To run a group of fixture, run this command with group name as parameter (specified via groups() method). It´s also case-insensitive.

Best Practices

Plugin Development

When you want to add fixtures to a plugin that you build, you might not want to deliver these fixtures in a production version of your plugin. In this case, we only want to add it to the "development" or "testing" scope of our plugin.

Create a new folder for your fixtures in a folder that is not your source folder that is delivered. You could use your "tests" folder for instance.

We then use the Shopware build() function of our main Plugin class to add the code below. This code will verify if our DEV dependencies from our composer dependencies are installed (just use any check like, is PHPUnit existing?...). Once it recognizes that DEV requirements are installed, we verify that our fixtures directory also exists, and then simply load those files with our correct namespace in our class loader. Afterwards we also load our custom XML services for our fixtures.

With this approach, the bin/console command of this FixturePlugin will only find fixtures, if dev-dependencies are installed in our plugin that we develop. If only production dependencies are installed, nothing is found and therefore no fixtures are (accidentally) loaded.

Contribution

This template uses a full-featured Dockware docker image. It already comes with a pre-installed Shopware 6 instance and everything you need to start developing.

Please see the Dockware documentation.

To start developing, simply start the container:

Access the container:

Install the dependencies and make everything ready (defined in composer.json and package.json). This command needs to be executed from the host-system (not in shell)

Linting

Before committing, please run the linting and static analysis tools. This command also needs to be executed from the host machine (not in shell):

Github Actions

The Github actions pipeline is already pre-configured. It contains multiple jobs for all linting, static analysis and testing tools.


All versions of sw6-fixtures-plugin with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1 || ^8.2
shopware/core Version 6.3.*|6.4.*|6.5.*
shopware/administration Version 6.3.*|6.4.*|6.5.*
shopware/storefront Version 6.3.*|6.4.*|6.5.*
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 basecom/sw6-fixtures-plugin contains the following files

Loading the files please wait ....