### Console command - setup:init-db Source: https://docs.spryker.com/docs/customer-access-feature-integration Executes registered installer plugins to install infrastructural data. Run this command after registering the CustomerAccessInstallerPlugin. ```bash console setup:init-db ``` -------------------------------- ### Install search with search:setup Source: https://docs.spryker.com/docs/pbc/all/search/latest/base-shop/install-and-upgrade/upgrade-modules/upgrade-the-productpagesearch-module.html Installs the search index for the ProductPageSearch 3.0.0 upgrade. Run after generating transfers. ```bash vendor/bin/console search:setup ``` -------------------------------- ### Install search Source: https://docs.spryker.com/docs/en/migration-guide-productpagesearch Run this command to set up the search infrastructure. ```bash vendor/bin/console search:setup ``` -------------------------------- ### Install Click & Collect example calculator strategy Source: https://docs.spryker.com/docs/pbc/all/offer-management/latest/unified-commerce/install-features/install-the-product-offer-service-points-availability-feature.html Optional Composer command to install an example calculator strategy for Click & Collect product offer service point availability. Run this only if you need the example strategy. ```bash composer require spryker/click-and-collect-example: "^0.1.0" --update-with-dependencies ``` -------------------------------- ### Setup OAuth client Source: https://docs.spryker.com/docs/integrations/spryker-glue-api/backend-api/integrate-backend-api/integrate-the-authentication.html Command to initialize the database, setting up the OAuth client. ```bash vendor/bin/console setup:init-db ``` -------------------------------- ### GET request examples for related products Source: https://docs.spryker.com/docs/pbc/all/product-relationship-management/latest/glue-api-retrieve-related-products.html Two GET request examples: one without query parameters and one with the 'include' parameter to include product labels in the response. ```http GET https://glue.mysprykershop.com/abstract-products/122/related-products ``` ```http GET https://glue.mysprykershop.com/abstract-products/122/related-products?include=product-labels ``` -------------------------------- ### Request example: GET https://glue.mysprykershop.com/guest-carts Source: https://docs.spryker.com/docs/pbc/all/cart-and-checkout/manage-using-glue-api/manage-guest-carts/manage-guest-carts.html Example request to retrieve a guest cart. ```http GET https://glue.mysprykershop.com/guest-carts ``` -------------------------------- ### Boot and start Docker SDK with assets Source: https://docs.spryker.com/docs/pbc/all/dynamic-multistore/latest/base-shop/install-and-upgrade/install-features/install-dynamic-multistore.html Boots the Docker SDK and starts the application with assets to enable Dynamic Multistore locally. After running, verify the store is accessible at the expected Yves or Back Office URL and that the store switcher appears on the Storefront. ```bash docker/sdk boot && docker/sdk up --assets ``` -------------------------------- ### Run search:setup command Source: https://docs.spryker.com/docs/pbc/all/self-service-portal/latest/install/install-the-ssp-asset-management-feature.html Runs the search setup command to prepare search indexes after registering the synchronization plugins. ```bash console search:setup ``` -------------------------------- ### Execute installer plugins (console setup:init-d) Source: https://docs.spryker.com/docs/pbc/all/cart-and-checkout/install-and-upgrade/install-features/install-the-checkout-feature.html Console command to execute registered installer plugins and install infrastructural data. ```bash console setup:init-d ``` -------------------------------- ### GitHub Actions workflow for Spryker validation Source: https://docs.spryker.com/docs/en/configuring-github-actions Example .github/workflows/{project_name}.yml that runs a validation job with steps for environment setup, dependency installation, code generation, frontend tasks, and validation commands. Uses PHP 8.0, Elasticsearch 7.6.0, and Node 18. ```yaml ... jobs: ... validation: name: "CS, ArchSniffer, PHPStan, Security" runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: php-version: [ '8.0' ] env: APPLICATION_ENV: devtest APPLICATION_STORE: DE PROJECT: project-name steps: - uses: actions/checkout@v3 - name: Configure sysctl limits run: | sudo swapoff -a sudo sysctl -w vm.swappiness=1 sudo sysctl -w fs.file-max=262144 sudo sysctl -w vm.max_map_count=262144 - name: Runs Elasticsearch uses: elastic/elastic-github-actions/elasticsearch@master with: stack-version: 7.6.0 port: 10005 - uses: actions/setup-node@v3 with: node-version: '18' - name: NPM cache uses: actions/cache@v3 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - name: Composer get cache directory id: composer-cache run: | echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Composer cache uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: | ${{ runner.os }}-composer- - name: Composer validate run: composer validate - name: Composer install run: | composer --version composer install - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} extensions: mbstring, intl, pdo_mysql tools: composer:v2 - name: Generate transfer objects run: vendor/bin/console transfer:generate - name: Generate transfer databuilder objects run: vendor/bin/console transfer:databuilder:generate - name: Propel install run: | vendor/bin/console propel:schema:copy vendor/bin/console propel:model:build vendor/bin/console transfer:entity:generate - name: Setup search run: vendor/bin/console setup:search - name: Codecept build run: vendor/bin/codecept build --ansi - name: Generate autocompletion files run: vendor/bin/console dev:ide-auto-completion:generate - name: Generate rest API dcoumentation run: vendor/bin/console rest-api:generate:documentation - name: Frontend install-dependencies run: | vendor/bin/console frontend:project:install-dependencies -vvv - name: Install NPM packages run: | sudo npm install --location=global --unsafe-perm speccy@0.11.0 - name: Speccy lint Glue specification run: speccy lint src/Generated/Glue/Specification/spryker_rest_api.schema.yml --rules=default - name: Style lint run: npm run yves:stylelint - name: ES lint run: npm run yves:lint - name: Front-end Formatter run: npm run formatter - name: Front-end MP Lint run: npm run mp:lint - name: Front-end MP Style lint run: npm run mp:stylelint - name: Front-end MP Unit Tests run: npm run mp:test - name: Validate propel files run: | vendor/bin/console propel:schema:validate vendor/bin/console propel:schema:validate-xml-names - name: Validate transfer files run: vendor/bin/console transfer:validate - name: Run CodeStyle checks run: vendor/bin/console code:sniff:style - name: Run Architecture rules run: vendor/bin/phpmd src/ text vendor/spryker/architecture-sniffer/src/ruleset.xml --minimumpriority 2 - name: Run PHPStan run: vendor/bin/phpstan analyze -l 5 -c phpstan.neon src/ - name: Run Security check run: vendor/bin/console security:check ... ``` -------------------------------- ### Install optional Click&Collect example module Source: https://docs.spryker.com/docs/pbc/all/offer-management/latest/marketplace/install-and-upgrade/install-features/install-the-product-offer-shipment-feature.html Optional: Run this Composer command to install the Click&Collect example module for demo functionalities. The command uses the version ^0.4.0 and updates dependencies. ```bash composer require spryker/click-and-collect-example: "^0.4.0" --update-with-dependencies ``` -------------------------------- ### Bootstrap docker setup Source: https://docs.spryker.com/docs/configuring-github-actions Boots the Docker SDK with the specified deploy file. ```bash docker/sdk boot {deploy_file.yml} ``` -------------------------------- ### Test GET endpoint with cURL Source: https://docs.spryker.com/docs/integrations/spryker-api/backend-api/developing-apis/create-routes.html Example cURL command to test the GET endpoint at https://glue-backend.mysprykershop.com/module/bar. ```bash curl --location --request GET 'https://glue-backend.mysprykershop.com/module/bar' \ --header 'Accept: application/json' ``` -------------------------------- ### Set up queue infrastructure Source: https://docs.spryker.com/docs/pbc/all/dynamic-multistore/latest/base-shop/install-and-upgrade/install-features/install-dynamic-multistore.html Set up the queue infrastructure. After running, verify the sync.storage.store queue exists in RabbitMQ. ```bash vendor/bin/console queue:setup ``` -------------------------------- ### Execute Install Command Source: https://docs.spryker.com/docs/pbc/all/miscellaneous/latest/install-and-upgrade/install-features/install-the-push-notification-feature.html Runs the console command to initialize the database and execute installer plugins. ```bash docker/sdk console setup:init-db ``` -------------------------------- ### Import new configuration relations with setup:init-db Source: https://docs.spryker.com/docs/integrations/custom-building-integrations/data-exchange/install-and-upgrade-data-exchange-api/install-the-data-exchange-api.html Runs the console command to import the new configuration relations into the database. This is required after adding the dynamic entity configuration. ```bash vendor/bin/console setup:init-db ``` -------------------------------- ### Install warehouse allocation modules Source: https://docs.spryker.com/docs/pbc/all/warehouse-management-system/latest/base-shop/install-and-upgrade/install-features/install-the-inventory-management-feature.html Run these composer commands to install the required modules for product and product offer warehouse allocation examples. ```bash composer require spryker/product-warehouse-allocation-example:"^0.3.0" --update-with-dependencies composer require spryker/product-offer-warehouse-allocation-example:"^0.3.0" --update-with-dependencies ``` -------------------------------- ### Verification - console event:trigger --help Source: https://docs.spryker.com/docs/pbc/all/content-management-system/latest/base-shop/install-and-upgrade/install-features/install-the-content-items-feature.html Run this command to verify the setup. Ensure that 'content' is returned as an available resource. ```bash console event:trigger --help ``` -------------------------------- ### GET request sample: retrieve sales units Source: https://docs.spryker.com/docs/pbc/all/product-information-management/latest/base-shop/manage-using-glue-api/concrete-products/glue-api-retrieve-sales-units.html Example GET request to retrieve sales units for the concrete product with SKU cable-vga-1-2. ```http GET http://glue.mysprykershop.com/concrete-products/cable-vga-1-2/sales-units ``` -------------------------------- ### Build and run B2C API React example Source: https://docs.spryker.com/docs/integrations/spryker-api/storefront-api/developing-apis/b2c-api-react-example/install-b2c-api-react-example.html Build and run the application. After starting, the app is available at http://react.local. Press Ctrl+C to stop it; run npm run serve:local to start it again. ```bash npm i npm run dist npm run serve:local ``` -------------------------------- ### InstallerDependencyProvider.php - Register CustomerAccessInstallerPlugin Source: https://docs.spryker.com/docs/customer-access-feature-integration Registers the CustomerAccessInstallerPlugin in the InstallerDependencyProvider to install configured content types. Execute 'console setup:init-db' to run the installer plugins. ```php */ public function getInstallerPlugins(): array { return [ new CustomerAccessInstallerPlugin(), ]; } } ``` -------------------------------- ### Apply frontend changes Source: https://docs.spryker.com/docs/pbc/all/product-information-management/latest/base-shop/third-party-integrations/smart-product-management/install-smart-product-management.html Run these commands to install dependencies and build the frontend for the Smart Product Management feature. ```bash npm install console frontend:project:install-dependencies console frontend:zed:build ``` -------------------------------- ### Product data structure example Source: https://docs.spryker.com/docs/pbc/all/request-for-quote/latest/install-and-upgrade/install-features/install-the-quotation-process-glue-api.html Example of a concrete product data structure with attributes, links, and nested objects, as shown in the setup behavior section. ```json { "type": "concrete-products", "id": "124_31623088", "attributes": { "sku": "124_31623088", "isDiscontinued": false, "discontinuedNote": null, "averageRating": null, "reviewCount": 0, "productAbstractSku": "124", "name": "HP ProDesk 400 G3", "description": "New powerful processors Give your business the strong foundation it needs for growth with the affordable and reliable HP ProDesk 400 SFF. Designed with essential security and manageability features, the HP ProDesk 400 helps keep your business growing. New sixth Gen Intel® Core™ processors bring powerful processing with Intel® HD 530 Graphics. Available DDR4 memory helps meet the demands of today's businesses. HP ProDesks are rigorously tested to help ensure reliability. During the HP Total Test Process, PCs experience 120,000 hours of performance trials to help get you through your business day. The HP ProDesk 400 SFF helps affordably build a solid IT infrastructure for your growing business and fits in smaller workspaces for easy deployment.", "attributes": { "processor_codename": "Skylake", "bus_type": "DMI3", "processor_threads": "4", "processor_cores": "2", "brand": "HP", "total_storage_capacity": "128 GB" }, "superAttributesDefinition": [ "total_storage_capacity" ], "metaTitle": "HP ProDesk 400 G3", "metaKeywords": "HP,Tax Exempt", "metaDescription": "New powerful processors Give your business the strong foundation it needs for growth with the affordable and reliable HP ProDesk 400 SFF. Designed with ess", "attributeNames": { "processor_codename": "Processor codename", "bus_type": "Bus type", "processor_threads": "Processor Threads", "processor_cores": "Processor cores", "brand": "Brand", "total_storage_capacity": "Total storage capacity" }, "productConfigurationInstance": null }, "links": { "self": "http://glue.de.spryker.local/concrete-products/124_31623088" } } ``` -------------------------------- ### Run console data:import product-measurement-sales-unit-store Source: https://docs.spryker.com/docs/product-measurement-unit-feature-integration Command to import the product measurement sales unit store data. Run after registering the plugin. ```bash console data:import product-measurement-sales-unit-store ``` -------------------------------- ### Authenticated GET request example Source: https://docs.spryker.com/docs/integrations/spryker-glue-api/authenticating-and-authorization/authenticating-and-authorization.html Example of an HTTP request with the access token in the Authorization header. Default access token lifetime is 8 hours. ```http GET /carts HTTP/1.1 Host: glue.mysprykershop.com Content-Type: application/json Authorization: Bearer eyJ0... Cache-Control: no-cache ```