2017 © Pedro Peláez
 

sylius-plugin plugin-skeleton

Acme example plugin for Sylius.

image

sylius/plugin-skeleton

Acme example plugin for Sylius.

  • Tuesday, July 10, 2018
  • by pjedrzejewski
  • Repository
  • 9 Watchers
  • 22 Stars
  • 798 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 16 Forks
  • 8 Open issues
  • 41 Versions
  • 18 % Grown

The README.md

Sylius Logo. , (*1)

Plugin Skeleton

Skeleton for starting Sylius plugins., (*2)

Documentation

For a comprehensive guide on Sylius Plugins development please go to Sylius documentation, there you will find the Plugin Development Guide, that is full of examples., (*3)

Quickstart Installation

Traditional

  1. Run composer create-project sylius/plugin-skeleton ProjectName., (*4)

  2. From the plugin skeleton root directory, run the following commands:, (*5)

    $ (cd tests/Application && yarn install)
    $ (cd tests/Application && yarn build)
    $ (cd tests/Application && APP_ENV=test bin/console assets:install public)
    
    $ (cd tests/Application && APP_ENV=test bin/console doctrine:database:create)
    $ (cd tests/Application && APP_ENV=test bin/console doctrine:schema:create)
    

To be able to set up a plugin's database, remember to configure you database credentials in tests/Application/.env and tests/Application/.env.test., (*6)

Docker

  1. Execute docker compose up -d, (*7)

  2. Initialize plugin docker compose exec app make init, (*8)

  3. See your browser open localhost, (*9)

Usage

Running plugin tests

  • PHPUnit, (*10)

    vendor/bin/phpunit
    
  • PHPSpec, (*11)

    vendor/bin/phpspec run
    
  • Behat (non-JS scenarios), (*12)

    vendor/bin/behat --strict --tags="~@javascript"
    
  • Behat (JS scenarios), (*13)

    1. Install Symfony CLI command., (*14)

    2. Start Headless Chrome:, (*15)

      google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1
      
    3. Install SSL certificates (only once needed) and run test application's webserver on 127.0.0.1:8080:, (*16)

      symfony server:ca:install
      APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon
      
    4. Run Behat:, (*17)

      vendor/bin/behat --strict --tags="@javascript"
      
  • Static Analysis, (*18)

    • Psalm, (*19)

      vendor/bin/psalm
      
    • PHPStan, (*20)

      vendor/bin/phpstan analyse -c phpstan.neon -l max src/  
      
  • Coding Standard, (*21)

    vendor/bin/ecs check
    

Opening Sylius with your plugin

  • Using test environment:, (*22)

    (cd tests/Application && APP_ENV=test bin/console sylius:fixtures:load)
    (cd tests/Application && APP_ENV=test bin/console server:run -d public)
    
  • Using dev environment:, (*23)

    (cd tests/Application && APP_ENV=dev bin/console sylius:fixtures:load)
    (cd tests/Application && APP_ENV=dev bin/console server:run -d public)
    

The Versions