valantic-spryker-eco / firstspirit-bridge-api
Provides backend api for FS Bridge API
Installs: 6 409
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=8.0
- spryker/api: >=0.4.1
- spryker/catalog: >=5.7
- spryker/category-storage: >=2.7
- spryker/cms-page-search: >=2.5
- spryker/cms-storage: >=2.6
- spryker/event-dispatcher: >=1.3
- spryker/kernel: >=3.70
- spryker/locale: >=3.8
- spryker/product-image-storage: >=1.13.0
- spryker/product-storage: >=1.36
- spryker/store: >=1.19
- spryker/transfer: >=3.33
- spryker/url-storage: >=1.15
Requires (Dev)
This package is auto-updated.
Last update: 2025-01-03 15:58:04 UTC
README
Description
- Provides backend api for FS Bridge API
Implementation:
- Install dependency
composer require valantic-spryker-eco/firstspirit-bridge-api
- Add configuration to
config_default.php
$firstSpiritSpaHost = 'www.frontend.de'; $config[FirstSpiritApiConstants::IS_FIRST_SPIRIT_API_DEBUG_ENABLED] = false; $config[FirstSpiritApiConstants::PAGING_SIZE] = 10; $config[FirstSpiritApiConstants::FIRST_SPIRIT_SPA_URL] = ($backofficePort === 80 ? 'http://' : 'https://') . $firstSpiritSpaHost;
- Register DispatcherPlugin
<?php namespace Pyz\Zed\EventDispatcher; use Spryker\Zed\EventDispatcher\EventDispatcherDependencyProvider as SprykerEventDispatcherDependencyProvider; use ValanticSpryker\Zed\FirstSpiritApi\Communication\Plugin\EventDispatcher\FirstSpiritApiControllerEventDispatcherPlugin; class EventDispatcherDependencyProvider extends SprykerEventDispatcherDependencyProvider { [...] /** * @return array<\Spryker\Shared\EventDispatcherExtension\Dependency\Plugin\EventDispatcherPluginInterface> */ protected function getBackendApiEventDispatcherPlugins(): array { return [ [...] new FirstSpiritApiControllerEventDispatcherPlugin(), ]; } }
- Register RouterPlugin
<?php namespace Pyz\Zed\Router; use Spryker\Zed\Router\RouterDependencyProvider as SprykerRouterDependencyProvider; use ValanticSpryker\Zed\FirstSpiritApi\Communication\Plugin\FirstSpiritApiRouterPlugin; class RouterDependencyProvider extends SprykerRouterDependencyProvider { [...] /** * @return array<\Spryker\Zed\RouterExtension\Dependency\Plugin\RouterPluginInterface> */ protected function getBackendApiRouterPlugins(): array { return [ [...] new FirstSpiritApiRouterPlugin(), ]; } }
- Register FirstSpirit ResourcePlugins:
<?php namespace Pyz\Zed\FirstSpiritApi; use ValanticSpryker\Zed\CategoryFirstSpiritApi\Communication\Plugin\CategoriesFirstSpiritApiResourcePlugin; use ValanticSpryker\Zed\CmsFirstSpiritApi\Communication\Plugin\CmsFirstSpiritApiResourcePlugin; use ValanticSpryker\Zed\FirstSpiritApi\FirstSpiritApiDependencyProvider as ValanticFirstSpiritApiDependencyProvider; use ValanticSpryker\Zed\ProductFirstSpiritApi\Communication\Plugin\ProductsFirstSpiritApiResourcePlugin; use ValanticSpryker\Zed\UrlResolverFirstSpiritApi\Communication\Plugin\LookUpFirstSpiritApiResourcePlugin; use ValanticSpryker\Zed\UrlResolverFirstSpiritApi\Communication\Plugin\StoreFrontFirstSpiritApiResourcePlugin; class FirstSpiritApiDependencyProvider extends ValanticFirstSpiritApiDependencyProvider { /** * @return array<\ValanticSpryker\Zed\FirstSpiritApi\Communication\Plugin\FirstSpiritApiResourcePluginInterface> */ protected function getApiResourcePluginCollection(): array { return [ new CategoriesFirstSpiritApiResourcePlugin(), new CmsFirstSpiritApiResourcePlugin(), new ProductsFirstSpiritApiResourcePlugin(), new LookUpFirstSpiritApiResourcePlugin(), new StoreFrontFirstSpiritApiResourcePlugin(), ]; } }
- Add FS PagingSize
<?php namespace Pyz\Client\Catalog; use Spryker\Client\Catalog\CatalogConfig as SprykerCatalogConfig; class CatalogConfig extends SprykerCatalogConfig { [...] /** * search catalog uses these values to validate product per page * FirstSpiritApiConstants::PAGING_SIZE should be added here as well * * @var array<int> */ protected const PAGINATION_CATALOG_SEARCH_VALID_ITEMS_PER_PAGE = [10, 12, 24, 36]; }
Documentation:
FS API Docs: https://docs.e-spirit.com/ecom/fsconnect-com-api/FirstSpirit_Connect_for_Commerce_Bridge_API_EN.html
HowTos
PHP Container: docker run -it --rm --name my-running-script -v "$PWD":/data spryker/php:latest bash
Run Tests: codecept run --env standalone
Fixer: vendor/bin/phpcbf --standard=phpcs.xml --report=full src/ValanticSpryker/
Disable opcache: mv /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini /usr/local/etc/php/conf.d/docker-php-ext-opcache.iniold
XDEBUG:
-
ip addr | grep '192.'
-
$docker-php-ext-enable xdebug
-
configure phpstorm (add 127.0.0.1 phpstorm server with name valantic)
-
$PHP_IDE_CONFIG=serverName=valantic php -dxdebug.mode=debug -dxdebug.client_host=192.168.87.39 -dxdebug.start_with_request=yes ./vendor/bin/codecept run --env standalone
-
Run Tests with coverage:
XDEBUG_MODE=coverage vendor/bin/codecept run --env standalone --coverage --coverage-xml --coverage-html