webgriffe / sylius-table-rate-shipping-plugin
Provides table rate shipping calculator.
Installs: 87 523
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 4
Forks: 10
Open Issues: 3
Type:sylius-plugin
pkg:composer/webgriffe/sylius-table-rate-shipping-plugin
Requires
- php: ^8.2
- sylius/sylius: ^2.0
Requires (Dev)
- behat/behat: ^3.16
- behat/mink: ^1.13
- behat/mink-selenium2-driver: ^1.7
- dbrekelmans/bdi: ^1.4
- dmore/behat-chrome-extension: ^1.4
- dmore/chrome-mink-driver: ^2.9
- 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
- phpspec/phpspec: ^8.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^1.12
- phpstan/phpstan-doctrine: ^1.3
- phpstan/phpstan-strict-rules: ^1.3.0
- phpstan/phpstan-webmozart-assert: ^1.2
- phpunit/phpunit: ^10.5
- polishsymfonycommunity/symfony-mocker-container: ^1.0
- psalm/plugin-symfony: ^5.2
- sylius-labs/coding-standard: ^4.4
- sylius-labs/suite-tags-extension: ~0.2
- sylius/sylius-rector: ^2.0
- sylius/test-application: ^2.0.0@alpha
- symfony/browser-kit: ^6.4 || ^7.1
- symfony/debug-bundle: ^6.4 || ^7.1
- symfony/dotenv: ^6.4 || ^7.1
- symfony/http-client: ^6.4 || ^7.1
- symfony/intl: ^6.4 || ^7.1
- symfony/runtime: ^6.4 || ^7.1
- symfony/web-profiler-bundle: ^6.4 || ^7.1
- symfony/webpack-encore-bundle: ^2.2
- vimeo/psalm: ^6.13
README
Table Rate Shipping Plugin
This plugin allows to define shipping rates using weight tables.
Installation
-
Run
composer require --no-scripts webgriffe/sylius-table-rate-shipping-plugin: it's normal that the "cache:clear" command, that is executed automatically at the end, fails because you have to do the next steps. -
If they have not been added automatically, you have to add these bundles to
config/bundles.phpfile:Webgriffe\SyliusTableRateShippingPlugin\WebgriffeSyliusTableRateShippingPlugin::class => ['all' => true],
-
Add the plugin's configs by creating the file
config/packages/webgriffe_sylius_table_rate_shipping_plugin.yamlwith the following content:imports: - { resource: "@WebgriffeSyliusTableRateShippingPlugin/config/config.yaml" }
-
Add the plugin's routes by creating the file
config/routes/webgriffe_sylius_table_rate_shipping_plugin.yamlwith the following content:webgriffe_sylius_table_rate_shipping_plugin_admin: resource: "@WebgriffeSyliusTableRateShippingPlugin/config/routes/admin.yaml" prefix: /%sylius_admin.path_name%
-
Finish the installation by updating the database schema:
bin/console cache:clear bin/console doctrine:migrations:migrate
Contributing
To contribute you need to:
-
Clone this repository into you development environment and go to the plugin's root directory,
-
Then, from the plugin's root directory, run the following commands:
composer install
-
Copy
tests/TestApplication/.envintests/TestApplication/.env.localand set configuration specific for your development environment. -
Link node_modules:
ln -s vendor/sylius/test-application/node_modules node_modules
-
Run docker (create a
compose.override.ymlif you need to customize services):docker-compose up -d
-
Then, from the plugin's root directory, run the following commands:
composer test-app-init
-
Run your local server:
symfony server:ca:install symfony server:start -d
-
Now at http://localhost:8080/ you have a full Sylius testing application which runs the plugin
Static checks
-
Coding Standard
vendor/bin/ecs check --fix
-
Psalm
vendor/bin/psalm
-
PHPStan
vendor/bin/phpstan analyse
Testing
After your changes you must ensure that the tests are still passing.
First setup your test database:
```bash
APP_ENV=test vendor/bin/console doctrine:database:create
APP_ENV=test vendor/bin/console doctrine:migrations:migrate -n
# Optionally load data fixtures
APP_ENV=test vendor/bin/console sylius:fixtures:load -n
```
And build assets:
(cd vendor/sylius/test-application && yarn install) (cd vendor/sylius/test-application && yarn build) vendor/bin/console assets:install
The current CI suite runs the following tests:
- PHPUnit
vendor/bin/phpunit
- PHPSpec
vendor/bin/phpspec run
- Behat (non-JS scenarios)
vendor/bin/behat --strict --tags="~@javascript"
-
Behat (JS scenarios)
-
Start Headless Chrome:
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
- Install SSL certificates (only once needed) and run test application's webserver on
127.0.0.1:8080:
symfony server:ca:install APP_ENV=test symfony server:start --port=8080 --dir=tests/TestApplication/public --daemon
- Run Behat:
vendor/bin/behat --strict --tags="@javascript"
License
This library is under the MIT license. See the complete license in the LICENSE file.
Credits
Developed by Webgriffe®.