eiling-io / sylius-battery-included-plugin
SyliusBatteryIncluded plugin for Sylius
Package info
github.com/eiling-io/batteryincluded-sylius
Type:sylius-plugin
pkg:composer/eiling-io/sylius-battery-included-plugin
Requires
- php: ^8.2
- batteryincluded/batteryincluded-bundle: dev-main
- sylius/sylius: ^2.0
Requires (Dev)
- behat/behat: ^3.16
- dbrekelmans/bdi: ^1.4
- dmore/behat-chrome-extension: ^1.4
- dmore/chrome-mink-driver: ^2.9
- friends-of-behat/mink: ^1.11
- friends-of-behat/mink-browserkit-driver: ^1.6
- friends-of-behat/mink-debug-extension: ^2.1
- friends-of-behat/mink-extension: ^2.7
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.1
- friends-of-behat/symfony-extension: ^2.6
- friends-of-behat/variadic-extension: ^1.6
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^2.1
- phpstan/phpstan-doctrine: ^2.0
- phpstan/phpstan-webmozart-assert: ^2.0
- phpunit/phpunit: ^10.5
- sylius-labs/coding-standard: ^4.4
- sylius-labs/suite-tags-extension: ~0.2
- sylius/cms-plugin: ^1.1
- sylius/sylius-rector: ^3.0
- sylius/test-application: ^2.0.0@alpha
- symfony/browser-kit: ^6.4 || ^7.4
- symfony/debug-bundle: ^6.4 || ^7.4
- symfony/dotenv: ^6.4 || ^7.4
- symfony/http-client: ^6.4 || ^7.4
- symfony/intl: ^6.4 || ^7.4
- symfony/runtime: ^6.4 || ^7.4
- symfony/web-profiler-bundle: ^6.4 || ^7.4
- symfony/webpack-encore-bundle: ^2.2
Suggests
- sylius/cms-plugin: Exports the CMS pages to BatteryIncluded and shows them in the search and the suggestions
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-29 21:06:59 UTC
README
Documentation
https://sylius.batteryincluded.eiling.io/ – installation, configuration, shop features, export and extension points.
Requirements:
- PHP 8.2 or higher
- Sylius 2.0 or higher
Installation
- Run
composer require eiling-io/sylius-battery-included-plugin:dev-main
The plugin uses batteryincluded/batteryincluded-bundle in dev-main, until it is released the composer.json of
the shop needs "minimum-stability": "dev" and "prefer-stable": true.
- enable the plugin and the BatteryIncluded bundle in
config/bundles.php:
<?php return [ // ... Batteryincluded\BatteryincludedBundle\BatteryincludedBundle::class => ['all' => true], EilingIo\SyliusBatteryIncludedPlugin\EilingIoSyliusBatteryIncludedPlugin::class => ['all' => true], ];
- add the credentials of the default collection to the
.envfile:
BATTERYINCLUDED_COLLECTION="" BATTERYINCLUDED_API_KEY="" #BATTERYINCLUDED_BASE_URL="https://api.batteryincluded.io/api/v1/collections/" # optional, this is the default
All further settings (cache, logging, http client, ...) are described in the bundle configuration.
With more than one channel assign a collection to every channel, channels may also share one (see shared collections):
# config/packages/batteryincluded.yaml batteryincluded: collections: ch: collection: '%env(BATTERYINCLUDED_COLLECTION_CH)%' api_key: '%env(BATTERYINCLUDED_API_KEY_CH)%' eiling_io_sylius_battery_included: channels: # channel code => collection, channels without collection use "default" FASHION_WEB: default FASHION_CH: ch
Without channels the first enabled channel is exported into the default collection.
- Import config in
config/packages/_sylius.yaml:
# imports: # ... - { resource: "@EilingIoSyliusBatteryIncludedPlugin/config/config.yaml" } # ...
- Import routing
config/routes/eiling_io_batteryincluded.yaml, the routes are prefixed with/{_locale}:
eiling_io_sylius_battery_included_plugin: resource: "@EilingIoSyliusBatteryIncludedPlugin/config/routes.yaml"
- Import assets in
assets/shop/assets.yaml:
... import '@vendor/eiling-io/sylius-battery-included-plugin/assets/shop/entrypoint.js'; import '@vendor/eiling-io/sylius-battery-included-plugin/assets/shop/styles.css';
- Export the products, one collection per call:
bin/console bi:export --force # default collection bin/console bi:export -c ch --force # collection "ch" bin/console bi:sync PRODUCT-5 # single products, e.g. after an update
Only enabled products of the channel are exported. See the
console commands of the bundle for bi:status,
bi:search and more.
Contributing
ddev startddev init- Open your browser and navigate to
https://syliusbatteryincludedplugin.ddev.site/.
Tests
The functional tests render the shop with the Sylius fixtures, the BatteryIncluded api is mocked
(tests/Functional/MockApi.php). Prepare the test database once:
ddev exec 'export APP_ENV=test DATABASE_URL=mysql://root:root@db/eiling_io_sylius_battery_included_plugin_test; vendor/bin/console doctrine:database:create && vendor/bin/console doctrine:migrations:migrate -n && vendor/bin/console sylius:fixtures:load -n'
ddev exec vendor/bin/phpunit --testsuite unit ddev exec 'DATABASE_URL=mysql://root:root@db/eiling_io_sylius_battery_included_plugin_test vendor/bin/phpunit' ddev exec vendor/bin/phpstan analyse -c phpstan.neon
The GitHub workflow (.github/workflows/ci.yml) runs them for Sylius 2.2 and 2.3.