|
| 1 | +# Copilot Instructions — bluem-woocommerce |
| 2 | + |
| 3 | +## Project overview |
| 4 | + |
| 5 | +WordPress + WooCommerce plugin providing Bluem payment, eMandates and iDIN identity services. |
| 6 | +PHP 8.0+, using the `bluem-development/bluem-php` SDK. Licensed GPL v3. |
| 7 | + |
| 8 | +## Repository layout |
| 9 | + |
| 10 | +| Path | Purpose | |
| 11 | +|---|---| |
| 12 | +| `bluem.php` | Main plugin entry point (WP plugin header) | |
| 13 | +| `bluem-*.php` | Feature modules (payments, mandates, iDIN, login, etc.) | |
| 14 | +| `gateways/` | WooCommerce payment gateway classes | |
| 15 | +| `src/` | Namespaced PHP classes (`Bluem\Wordpress\…`) | |
| 16 | +| `views/` | Admin page templates | |
| 17 | +| `css/`, `js/` | Front-end assets | |
| 18 | +| `tests/Unit/`, `tests/Acceptance/` | PHPUnit + Codeception tests | |
| 19 | +| `docker-compose.yml` | Local dev env (MySQL 5.7, WordPress, phpMyAdmin) | |
| 20 | +| `svn-directory/` | WordPress.org SVN checkout for plugin releases | |
| 21 | +| `build/` | Generated build output (do **not** edit directly) | |
| 22 | +| `Makefile` | Dev & release tasks (see below) | |
| 23 | + |
| 24 | +## Key commands |
| 25 | + |
| 26 | +```sh |
| 27 | +make install # composer install |
| 28 | +make unit_test # PHPUnit |
| 29 | +make acceptance_test # Codeception |
| 30 | +make lint # php-cs-fixer check |
| 31 | +make lint_fix # php-cs-fixer fix |
| 32 | +make copy-to-docker # build & copy plugin into Docker env |
| 33 | +make prepare-release NEW_TAG=x.y.z # build, tag, update trunk (SVN) |
| 34 | +make release # commit prepared release to WP SVN |
| 35 | +``` |
| 36 | + |
| 37 | +## Coding conventions |
| 38 | + |
| 39 | +- `declare(strict_types=1);` in all PHP files. |
| 40 | +- Follow WordPress Coding Standards (WPCS) and PSR-12 where compatible. |
| 41 | +- Use typed properties, return types, union types, readonly, enums (PHP 8.x). |
| 42 | +- WordPress globals and hooks: use `add_action` / `add_filter`; avoid direct DB queries — use `$wpdb` with prepared statements. |
| 43 | +- WooCommerce gateway classes extend `WC_Payment_Gateway`. |
| 44 | +- Escape all output (`esc_html`, `esc_attr`, `wp_kses_post`). Sanitise all input (`sanitize_text_field`, `absint`, etc.). |
| 45 | + |
| 46 | +## Release workflow |
| 47 | + |
| 48 | +1. Bump version in `bluem.php` plugin header and `build.env`. |
| 49 | +2. `make prepare-release NEW_TAG=x.y.z` — builds into `build/`, copies to `svn-directory/tags/` and `svn-directory/trunk/`. |
| 50 | +3. `make release` — commits tag + trunk to WordPress.org SVN. |
| 51 | + |
| 52 | +## Things to watch out for |
| 53 | + |
| 54 | +- `build/` and `svn-directory/` are deployment artifacts; never edit them directly. |
| 55 | +- Docker volumes live under `docker/`; plugin code is mounted via `docker/plugins/`. |
| 56 | +- The plugin depends on `bluem-development/bluem-php` — check its API when suggesting SDK calls. |
| 57 | +- Keep WP compatibility ≥ 5.0 and WC compatibility reasonable. |
| 58 | + |
0 commit comments