Skip to content

Architecture

Repo structure

barberklingen-dk-bedrock/
├── site/               # Bedrock WordPress application
├── devops/             # Docker configs per environment (local/, dev/, prod/)
│   └── {env}/
│       ├── php/        # Dockerfile, php.ini, www.conf
│       ├── nginx/      # Dockerfile, nginx.conf, default.conf, certs
│       └── mysql/      # Dockerfile, my.cnf
├── system/             # Runtime state (git-ignored contents)
│   ├── logs/           # Nginx, PHP, Redis, WordPress debug logs
│   ├── releases/       # Deployed release symlinks
│   └── wp-uploads/     # Persistent media uploads
├── customizations/     # Root-level asset sources (synced to site/)
│   ├── plugin/         # Compiled plugin assets (output of yarn build)
│   └── statics/        # Source JS and SASS
└── docs/               # Project documentation

Bedrock application (site/)

Standard Bedrock layout:

site/
├── config/
│   ├── application.php         # Base config (env loading, WP constants)
│   ├── container.php           # Dependency injection wiring
│   ├── local.php               # (git-ignored) Machine-specific overrides
│   └── environments/
│       ├── development.php
│       ├── staging.php
│       └── production.php
├── customizations/
│   ├── plugin/                 # The main custom WP plugin (barberklingen/barberklingen)
│   └── statics/                # Frontend source files (JS + SASS)
├── scripts/
│   └── CustomInstaller.php     # Composer post-install script (copies vendor statics to theme)
├── web/
│   ├── wp/                     # WordPress core (git-ignored, installed by Composer)
│   ├── wp-config.php           # Minimal shim that loads Bedrock config
│   ├── index.php               # WordPress bootstrap
│   └── app/                    # WP content directory (replaces wp-content)
│       ├── mu-plugins/         # Must-use plugins (Bedrock autoloader, etc.)
│       ├── plugins/            # Composer-managed plugins (git-ignored)
│       ├── themes/             # barberklingen + barberklingen-child
│       └── uploads/            # (git-ignored, volume-mounted)
├── vendor/                     # Composer dependencies (git-ignored)
├── vendor-plugins/             # Local path-repo vendor plugins
├── composer.json
├── package.json / yarn.lock    # Frontend build tooling
├── webpack.mix.js              # Laravel Mix config
├── phpcs.xml                   # PSR-2 lint config
├── phpunit.xml                 # PHPUnit config
└── wp-cli.yml                  # WP-CLI path config

Custom plugin (site/customizations/plugin/)

The core business logic lives here as a WordPress plugin (Barberklingen namespace). It is loaded via a Composer path repository so it gets the same autoloading as any other package.

Key entry points: - Barberklingen.php — plugin header and class instantiation - bootstrap.php — loads vendor autoloader and helper includes

Class organisation under classes/:

Directory Responsibility
Account/ My Account page customisations
Auth/ JWT auth tokens, login error handling
Checkout/ Checkout flow hooks, gift flow, referral coupons
Cart/ Cart hooks, quantity discounts
Subscriptions/ Subscription lifecycle, pricing, renewals
Payment/ QuickPay, MobilePay, payment hub wiring
Orders/ Order item hooks, order management
Labels/ Shipping label generation (DAO, VIP)
Bladkompagniet/ Fulfilment partner API integration
Klaviyo/ Email/SMS marketing events
Api/ Custom REST API endpoints
CLI/ WP-CLI commands (wp barberklingen ...)
Extensions/ Integrations with third-party plugins
Data/ Data access and override layer
Emails/ WooCommerce email customisations

Dependency injection

site/config/container.php wires up the service container using league/container v4. The container is initialised via ygd_setup_container() (from barberklingen/base-plugin) and registers:

  • Klaviyo API config
  • MobilePay payment gateway config
  • WooCommerce payment integration service providers

Frontend assets

Built with Laravel Mix (webpack wrapper). Source lives in customizations/statics/, output goes to customizations/plugin/assets/.

Source Output
statics/js/admin/vendor.js plugin/assets/js/admin/vendor.min.js
statics/js/admin/app-label-generator.js plugin/assets/js/admin/app-label-generator.min.js
statics/js/admin/app-bladkompagniet.js plugin/assets/js/admin/app-bladkompagniet.min.js
statics/sass/admin/vendor.sass plugin/assets/css/admin/vendor.min.css

The barberklingen theme has its own separate webpack build managed from web/app/themes/barberklingen/.

Composer package sources

Repository Packages
wpackagist.org Public WP plugins and themes
packagist.barberklingen.dk Private barberklingen/* and barberklingen-premium/*
Path: customizations/plugin barberklingen/barberklingen (the custom plugin)
Path: vendor-plugins/* vendor-plugin/* (local vendor plugins)
composer.elementor.com elementor/elementor-pro
GitHub (package) tolvstein/php-klaviyo-api

Themes

  • barberklingen — parent theme with full frontend (Tailwind CSS, Vue.js components)
  • barberklingen-child — child theme for minor overrides

Cron

WP Cron is disabled (DISABLE_WP_CRON=true in production). Cron jobs are defined in system/cronjobs/ and system/shared-cronjobs/ and run via system cron calling WP-CLI.