Download the PHP package madcoders/sylius-rma-plugin without Composer

On this page you can find all versions of the php package madcoders/sylius-rma-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sylius-rma-plugin

Madcoders Sylius RMA Plugin

Latest Version CI

Sylius RMA (Return Merchandise Authorization) plugin by Madcoders lets customers create a return form and submit a return request from a delivered order.

Features

Requirements

Version
PHP 8.2
Sylius 1.12 - 1.13
Symfony 6.4

Installation

  1. Add as dependency in composer.json

  2. Enable plugin in config/bundles.php:

  3. Import required config in config/packages/_sylius.yaml file:

  4. Import routes config/routes.yaml file:

  5. Run migrations:

Configuration

All settings live under the madcoders_rma key (config/packages/madcoders_rma.yaml) and are optional; the defaults below match the plugin's out-of-the-box behaviour.

Setting Env var Type Default Effect
return_form_pdf_enabled - bool false Generate the return-form PDF (email attachment + print/download links); requires a reachable Gotenberg instance. See below.
gotenberg_url GOTENBERG_URL string http://127.0.0.1:3000 Base URL of the Gotenberg instance used to render the PDF. Only used when return_form_pdf_enabled is true.
allow_unpaid_withdrawal MADCODERS_RMA_ALLOW_UNPAID_WITHDRAWAL bool true Offer instant withdrawal of unpaid, not-yet-shipped orders (cancels the Sylius order). When false, unpaid orders are not offered withdrawal. See below.
require_additional_information MADCODERS_RMA_REQUIRE_ADDITIONAL_INFORMATION bool false Show and require the "Additional information" section (bank account number, account holder name, bank name / BIC-SWIFT) for refund handling on the return and withdrawal forms. When false, the section is hidden and not required. See below.
resources.* - map Sylius defaults Standard Sylius ResourceBundle overrides (model / interface / controller / factory / repository / form) for the plugin's entities.

Store data managed in the Sylius admin rather than config files: the return address per channel, return reasons (with optional time-since-shipment deadlines), and the consents a customer must accept.

Optional: enable the return-form PDF

PDF generation (the confirmation-email attachment and the print/download links) is off by default and requires a reachable Gotenberg instance (a Docker-based HTTP API for document conversion, built on headless Chromium). To enable it:

For local development, docker-compose.yml includes a gotenberg service - make docker-up-all starts it alongside MySQL and Chrome. In production, run Gotenberg as its own container/service and point GOTENBERG_URL at it.

See ADR 0013.

Optional: instant withdrawal of unpaid orders

When a not-yet-shipped order is unpaid, it is withdrawn instantly (the Sylius order is cancelled and the return resolves straight to withdrawn, with no admin step). This is on by default. Paid orders are always withdrawable via admin approval regardless of this flag.

Toggle it with the MADCODERS_RMA_ALLOW_UNPAID_WITHDRAWAL environment variable:

or override the parameter directly:

When disabled, an unpaid order is not offered the withdrawal flow at all.

Return consents: external page vs inline HTML

Each return consent (managed in the Sylius admin) has a field type that controls how it is shown next to its checkbox on the return form:

The admin create/edit consent form carries a short instruction describing both options.

Optional: require additional information on the return form

The return form can collect the bank details needed to handle a refund: bank account number (validated as an IBAN), account holder name, and bank name / BIC-SWIFT. This "Additional information" section is off by default - the section is hidden and none of its fields are required, so a customer can submit a return without bank details. The same applies to the withdrawal form, which the flag governs identically.

Enable it with the MADCODERS_RMA_REQUIRE_ADDITIONAL_INFORMATION environment variable:

or override the parameter directly:

When enabled, the section is rendered on the return form and on the pre-shipment withdrawal form, and all three fields are required on both. The values are persisted on the OrderReturn and shown (when present) in the admin and shop account return views.

Note for upgrades: before 1.3.0-rc.5 the withdrawal form always collected the bank account number regardless of this flag. It now follows the flag like the return form does, so with the flag off (the default) a withdrawal no longer asks for bank details at all. If your refund process depends on having an account number for every withdrawal, turn the flag on.

Optional: mark products as non-returnable

Some products cannot be taken back (perishables, hygiene/sealed goods, made-to-order items, gift cards). Return eligibility is normally decided per order; this adds an item-level rule so such products are excluded from the return flow even on an otherwise returnable order.

Once enabled (see below), the admin product form gains a "Non-returnable" checkbox. With it ticked:

Out of the box every product is returnable. To enable the flag, have your Sylius Product model implement NonReturnableProductInterface and apply NonReturnableProductTrait (the trait supplies the non_returnable column and accessors):

Then run the plugin migration (it adds the non_returnable column to sylius_product). The checkbox is added to the admin product form automatically (a form-type extension, rendered via the sylius.admin.product.tab_details template event) once the model implements the interface. To source the flag from somewhere other than the product entity, replace ProductReturnabilityCheckerInterface.

Per-order return grace periods

A return reason is available while the number of days since the order's first shipment does not exceed the reason's deadline. When support agrees an exception with one customer (the parcel was delayed, the customer was abroad), an admin can extend a reason for that order only instead of raising the deadline for everyone.

The Sylius admin order page shows a "Return grace periods" panel listing every enabled reason with its deadline, the extra days granted for the order and the resulting last return day. From there an admin can:

With a 14-day reason and 10 extra days, the reason is offered until day 24 after shipment for that order; other orders and other reasons keep their normal deadline. A grace period never makes an unshipped, unfulfilled or fully returned order returnable, and never re-enables a disabled reason. Every grant, change and revocation is recorded with the admin's name, the time and the note, and listed on the same panel.

Grace periods are stored in their own tables (run the plugin migrations). If you replaced the deadline checker (ReturnDeadlineCheckerInterface), implement GraceAwareReturnDeadlineCheckerInterface for grace periods to apply; a checker that does not implement it keeps the base deadline.

Returns state machine

Every return form is an OrderReturn entity driven by a single winzou state machine (graph return_status, property orderReturnStatus). A form is created in draft and then moves through the graph depending on whether the customer is filing a return or withdrawing (cancelling) a pre-shipment order. The same graph also carries the admin-side resolution of a withdrawal request.

States: draft, new, completed, canceled, withdrawal_request, withdrawn.

Full graph

Standard return flow

A customer fills in the return form for a delivered order. On submit the new transition moves the form out of draft; an admin then either completes or cancels it.

Withdrawal (pre-shipment) flow

A withdrawal always ends in the terminal withdrawn state. Whether it gets there instantly (with the whole Sylius order cancelled) or via admin approval is decided by two checkers:

When instant-eligible (unpaid), the customer confirms in one click and the form fast-forwards straight to withdrawn via the withdraw transition, cancelling the whole Sylius order.

When paid/authorized, the customer instead sees the same item-selection screen as a standard return (WithdrawalReturnFormType over Return/view.html.twig) and can choose which items/quantities to withdraw - a partial withdrawal is allowed. Submitting raises a withdrawal_request that an admin resolves: confirming it (withdraw -> withdrawn) records the withdrawal but does not cancel the Sylius order, because the request may be partial - the refund and any order cancellation stay manual admin actions; or handling it as a normal return (fallback_to_return -> new). Either way the withdrawn quantities are claimed and cannot be returned again (MaxQtyCalculator counts every non-draft return).

Transitions and notifications

Several transitions fire after callbacks (changelog updates and customer e-mails), configured in config.yml. The withdraw transition uses winzou from-filtered callbacks so the instant (customer) and admin-approved cases send different notifications:

Transition From To After callback
new draft new -
complete new completed changelog update
cancel draft, new canceled changelog update
request_withdrawal draft withdrawal_request withdrawal-requested e-mail
withdraw draft withdrawn instant withdrawal e-mail (customer)
withdraw withdrawal_request withdrawn resolution (confirmed) e-mail (admin)
fallback_to_return withdrawal_request new resolution (fallback) e-mail

Customizations

Which RMA path an order is offered - return, withdrawal, or instant withdrawal - is decided by small single-method eligibility checkers. Each one is bound to an interface (with a default service alias) and is consumed everywhere through that interface (controllers, the rma_order_can_start_rma() Twig function, the reason provider), so you can change a rule for the whole plugin by pointing the alias at your own implementation.

Interface (Madcoders\SyliusRmaPlugin\Services\...) Method Decides Default service id (madcoders.sylius_rma_plugin.services...)
ReturnEligibilityCheckerInterface isReturnable(OrderInterface) whether a (post-shipment) order can be returned .return_eligibility_checker
Withdrawal\WithdrawalEligibilityCheckerInterface isWithdrawable(OrderInterface) whether a (pre-shipment) order is offered withdrawal at all .withdrawal.eligibility_checker
Withdrawal\InstantCancellationEligibilityCheckerInterface isEligible(OrderInterface) within withdrawal, instant (unpaid) vs admin approval (paid) .withdrawal.instant_cancellation_eligibility_checker
Reason\ReturnReasonEligibilityCheckerInterface isEligible(OrderInterface, OrderReturnReasonInterface) whether a given return reason is offered (deadline since shipment) .reason.return_reason_eligibility_checker
ProductReturnabilityCheckerInterface isReturnable(ProductVariantInterface) whether a single ordered variant may be added to a return (item-level) .product_returnability_checker

To replace one, implement its interface and alias it in your application:

Prefer to keep the default behaviour and only add to it? Decorate the default service instead:

Note that the default WithdrawalEligibilityChecker receives the allow_unpaid_withdrawal flag as a constructor argument; a full replacement is responsible for honouring that flag itself if it still applies.

Customize the e-mails

Every RMA e-mail is self-contained: it renders the return (RMA) number, the order number, the returned items, a state-appropriate message and - when provided - the refund (bank) details, so the customer gets a complete record even when the return-form PDF is off. The copy lives under the madcoders_rma.email.* translation keys (English plus pl, de, fr, it, es, sv, da).

Each e-mail is wrapped by an overridable header and footer partial - the integration point for your shop's branding. Override them in your application (they receive the channel in context):

The shared _returnSummary.html.twig partial renders the details block and can be overridden the same way.

Development

Requires PHP 8.2, Composer, Docker (for the database) and Node/Yarn (for the test application assets). Run make help to list every available command.

Quick start

make setup is a one-shot bootstrap. It is equivalent to:

Docker

The bundled docker-compose.yml provides the services the test suite needs:

The test application reads DATABASE_URL=mysql://root:[email protected]:3307/... from tests/Application/.env.

Tests

Static analysis & code style

PHPStan runs against a committed baseline (phpstan-baseline.neon) so only new issues fail the build.

Pre-commit hook

A git hook auto-fixes code style and verifies static analysis and unit tests before each commit. Install it once per clone:

On every git commit it runs make pre-commit, which:

  1. runs ecs --fix on staged PHP files and re-stages the result,
  2. runs PHPStan, ECS and PHPUnit, aborting the commit if any of them fail.

Bypass it in an emergency with git commit --no-verify.

Commit messages & changelog

Commits follow Conventional Commits (see ADR 0009); make install-hooks also installs the .gitmessage template. Notable changes are recorded in CHANGELOG.md under [Unreleased].

License

This library is under the EUPL 1.2 license.

Credits

Developed by MADCODERS
Architects of this package:

Buy Me A Coffee


All versions of sylius-rma-plugin with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
sylius/sylius Version >=1.12,<1.14
symfony/http-client Version ^6.4 || ^7.0
symfony/mime Version ^6.4 || ^7.0
twig/twig Version ^3.21
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package madcoders/sylius-rma-plugin contains the following files

Loading the files please wait ...