concept-image / wp-starter-theme
Base theme setup for WordPress with custom hooks and templates for Concept Image. Optimized for Roots Acorn.
Package info
gitlab.com/concept-image-public/wp-starter-theme
pkg:composer/concept-image/wp-starter-theme
Requires
- php: >=8.4
- concept-image/wp-ajax: ^0.2
- concept-image/wp-archive-base: ^4.0
- concept-image/wp-base-nav: ^1.0
- concept-image/wp-blocks: ^3.3
- concept-image/wp-core-ui: ^0.2
- concept-image/wp-cron: ^3.1
- concept-image/wp-custom-post-types: ^4.2
- concept-image/wp-footer-base: ^3.0
- concept-image/wp-fortress: ^0.2
- concept-image/wp-header: ^3.0
- concept-image/wp-hook-attributes: ^0.1
- concept-image/wp-query: ^1.2
- concept-image/wp-roles: ^3.0
- concept-image/wp-smtp: ^3.0
- log1x/acf-composer: ^3.4
- roots/acorn: ^6.4
Requires (Dev)
- brain/monkey: ^2.6
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^4.0|^5.0
- pestphp/pest-plugin-arch: ^4.0|^5.0
- szepeviktor/phpstan-wordpress: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 6.15.0
- 6.14.0
- 6.13.0
- 6.12.0
- 6.11.0
- 6.10.0
- 6.9.0
- 6.8.0
- 6.7.0
- 6.6.0
- 6.5.1
- 6.5.0
- 6.4.0
- 6.3.0
- 6.2.0
- 6.1.2
- 6.1.1
- 6.1.0
- 6.0.1
- 5.0.4
- 5.0.3
- 5.0.2
- 5.0.1
- 5.0.0
- 4.2.14
- 4.2.13
- 4.2.12
- 4.2.11
- 4.2.10
- 4.2.9
- 4.2.8
- 4.2.7
- 4.2.6
- 4.2.5
- 4.2.4
- 4.2.3
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.8
- 4.0.7
- 4.0.6
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- 3.1.10
- 3.1.9
- 3.1.8
- 3.1.7
- 3.1.6
- 3.1.5
- 3.1.4
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.12
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.0.2
- 2.0.1
- 2.0.0
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- 1.0
This package is auto-updated.
Last update: 2026-12-04 12:48:50 UTC
README
Acorn foundation for Concept Image WordPress themes
concept-image/wp-starter-theme is the base of every Concept Image theme built on Bedrock + Roots Acorn (Sage).
It ships:
- hook modules that set up and clean WordPress (admin, assets, comments/search/REST, medias, e-mails, Gravity Forms, ACF, TinyMCE, SEO/robots.txt, WP Rocket), with config switches for optional behaviors;
- custom Blade directives (
@filled,@woopage,@wpauth…); - a theme scaffold (views, components, config, Vite + Tailwind setup) published once into your theme;
- the mandatory Concept Image packages (blocks, custom post types, header/footer, query, roles, SMTP, cron, AJAX…);
- Claude Code files (skills, rules, a project
CLAUDE.md) for the Concept Image packages, published into your project bywp acorn starter:ai.
Requirements
- PHP 8.4+ (required by wp-query 1.0 and wp-custom-post-types 4.2)
- WordPress 6.5+ (script modules)
- Roots Acorn 6.4+
- Gravity Forms 3.0+ if used (native
<button>submit)
Installing this package also installs concept-image/wp-fortress (security) and concept-image/wp-hook-attributes,
plus concept-image/wp-ajax (^0.2: AJAX actions declared with #[Ajax] on the theme's app/Actions classes, nonce,
access and throttle checked, Alpine client published by wp acorn ajax:install), concept-image/wp-archive-base (^4.0: archive and filter UI,
<x-archive.*> / <x-filter.*> Tailwind + Alpine components published into the theme by wp acorn archive:install,
fed by the wp-query filters of archiveQuery() through ArchiveData, AJAX through a generated Filter{Type} action),
wp-base-nav, wp-blocks, wp-core-ui, wp-cron (^3.1: recurring
tasks declared with #[Schedule] on the theme's app/Actions classes or Hooks methods, wp acorn cron:sync), wp-custom-post-types
(^4.2: archive queries declared on the post type class, opted in with implements HasArchiveQuery (archiveQuery(), per page in protected static int $postsPerPage),
read with X::archive()), wp-footer-base, wp-header, wp-query (^1.2: fluent WP_Query builder, X::query(), eager
loading for cards, filters with ranges, dates and counts, pagination), wp-roles (^3.0: roles from the theme's config/roles.php, applied
with wp acorn roles:update), wp-smtp (^3.0: mail transport per environment from .env, Mailpit in development,
Ethereal in staging, a real SMTP server in production, wp acorn smtp:status / smtp:test) and log1x/acf-composer. Don't require them again in the theme. The generators concept-image/wp-make-block (blocks), concept-image/wp-make-cpt (post
types and taxonomies, ^3.0) and concept-image/wp-acorn-stubs (^2.0: make:hooks, make:ajax, make:schedule,
make:service, make:action, make:helper, make:value-object) go in the theme's require-dev.
Installation
From the theme directory:
composer require concept-image/wp-starter-theme
A theme composer.json then only needs:
"require": {
"php": ">=8.3",
"concept-image/wp-starter-theme": "^6.0",
"roots/acorn": "^6.1"
}
The service provider is auto-discovered by Acorn.
Publishing
# Everything at once, from the Bedrock root: scaffold, core components, AJAX client, archive components, Claude Code
# files (existing files kept)
wp acorn starter:install
starter:install runs the five steps below; run them on their own when needed:
# Theme scaffold (views, components, config, Vite setup). Existing files are kept unless --force.
wp acorn vendor:publish --tag="wp-starter-theme"
# Core components <x-core.*> (concept-image/wp-core-ui), missing ones only
wp acorn core-ui:install
# AJAX Alpine client (concept-image/wp-ajax) → resources/scripts/ajax, @alpinejs/morph in package.json.
# Add the lines it prints to resources/scripts/main.ts, then npm install
wp acorn ajax:install
# Archive and filter components (concept-image/wp-archive-base), default set, and their client → resources/scripts/archive.
# Add the lines it prints to resources/scripts/main.ts; `wp acorn archive:clean` drops the unused ones before delivery
wp acorn archive:install
# Claude Code skills, rules and CLAUDE.md → <bedrock root> (re-run with --force after updates)
wp acorn starter:ai
The scaffold is published once: it then belongs to the project. Package updates never modify it; compare
with vendor/concept-image/wp-starter-theme/theme when upgrading.
Architecture
ConceptImageWpStarterThemeServiceProvider registers each module as a singleton, then
HookRegistrar (concept-image/wp-hook-attributes) reads its PHP attributes and wires them into WordPress:
#[Action('admin_menu')]
#[WhenConfig('theme.disable.comments')] // registered only when the config value is truthy
public function removeCommentsMenu(): void { … }
#[Action(hook, priority)]/#[Filter(hook, priority)](fromconcept-image/wp-hook-attributes): repeatable; accepted arguments come from the method signature.#[WhenConfig(key, default, equals)]: on a class or a method; skips the hooks when the condition fails.
| Module | Class | What it does |
|---|---|---|
| Theme setup | Hooks\ThemeSetup | Text domain, editor-styles, theme.menus. |
| ACF | Hooks\ACF | Link fields store the target post ID (url_post_id) so URLs follow slug/parent changes (query string and #fragment kept); fields named form list Gravity Forms. |
| Admin | Hooks\Admin | Hides core update notices, Tools and Themes for non-admins; removes Site Editor/Customizer entries; footer credit; login logo → home. |
| Assets | Hooks\Assets | Vite styles/scripts (front, block editor, login), modulepreload, via Services\AssetsService. |
| jQuery | Hooks\Jquery | Front-end jQuery: removal, Gravity Forms exception, opt-in CDN + SRI. |
| Blade | Services\BladeService | Custom Blade directives. |
| Head | Hooks\Head | <head> cleanup (legacy links, generator, emoji, REST/oEmbed discovery). |
| oEmbed | Hooks\Oembed | oEmbed discovery, route and embed rewrite rules removed (disable.remove_json_api). |
| Block library | Hooks\BlockLibrary | Core block assets, block templates and patterns (disable.core_blocks). |
| Comments | Hooks\Comments | Comments and pings disabled everywhere (disable.comments). |
| Default post type | Hooks\DefaultPostType | "Posts" menu, "+ New post", Quick Draft widget (disable.default_post_type). |
| Search | Hooks\Search | Front-end search → 404, form and widget removed (disable.search). |
| Heartbeat | Hooks\Heartbeat | Removed in development, slowed elsewhere (heartbeat.*). |
| Gravity Forms | Hooks\GravityForm | Decoded subjects, default notification address, CSS removal, login to download uploads, no required legend. |
| Medias | Hooks\Medias | Image sizes, upload size limits, no sizes="auto". |
| Notifications | Hooks\Notifications | No admin e-mails for new users/password resets; no update success e-mails (SMTP transport, sender and envelope Sender: wp-smtp). |
| Performance | Hooks\Performance | WP Rocket preload tuning (theme.rocket). |
| SEO | Hooks\SEO | title-tag support, robots.txt (Builders\RobotsTxtBuilder), Yoast metabox at the bottom. |
| TinyMCE | Hooks\TinyMCE | theme.tiny_mce formats/toolbars, no custom color picker. |
Hooks in your theme
Themes use the same attributes. Write hook classes in app/Hooks and list them in the stub
ThemeServiceProvider:
protected array $hooks = [
\App\Hooks\ShopArchiveSlug::class,
];
public function boot()
{
foreach ($this->hooks as $hooks) {
HookRegistrar::register($this->app->make($hooks));
}
parent::boot();
}
Full theme conventions (Hooks, Services, Blade components, queries and performance, assets) are in the Claude skill:
resources/claude/skills/wp-starter-theme/references/theme-development.md
(published to .claude/skills/wp-starter-theme/ in projects).
Modules are always active: they are the base every project relies on. Only optional behaviors have a
config switch (comments, search, REST, core blocks, default post type, Heartbeat, Gravity Forms CSS,
title-tag, WP Rocket tuning), declared with #[WhenConfig] on the hook method. Change them in config,
never with remove_filter(): hook method names are not a stable API.
Configuration
config/theme.php
| Key | Default | Description |
|---|---|---|
menus | 4 menus | register_nav_menus() locations. |
images.sizes_to_remove | ['1536x1536', '2048x2048'] | Core sizes removed. |
images.sizes_to_add | [] | ['name', 'width', 'height', 'crop'] entries. |
tiny_mce.config | formats… | Merged into TinyMCE init (arrays JSON-encoded). |
tiny_mce.toolbars | Couleur | ACF WYSIWYG toolbars. |
disable.comments | true | Comments closed, hidden and removed from the admin. |
disable.search | true | Front-end searches return 404; search form/widget removed (admin searches untouched). |
disable.remove_json_api | true | Removes oEmbed discovery, route and embed rewrite rules (flush permalinks after toggling). |
disable.core_blocks | true | Dequeues block library/global styles, disables block templates and core patterns. |
disable.default_post_type | true | Hides the "Posts" menu and "+ New post". |
heartbeat.disable_in_development | true | Removes Heartbeat in development. |
heartbeat.interval | 120 | Heartbeat interval (15–120 s) elsewhere; skipped when WP Rocket controls Heartbeat; 0 = core default. |
uploads.max_size.image / docs / video | 3 / 5 / 100 (the stub reads env IMAGE_/DOCS_/VIDEO_MAX_UPLOAD_MO_SIZE) | Max upload size in MB per MIME family (image/font, text/application/audio, video). |
gravity_forms.disable_css | true | Removes all Gravity Forms stylesheets. |
gravity_forms.default_address | env GRAVITY_FORMS_DEFAULT_ADDRESS | Replaces {admin_email} notification recipients. |
supports.breadcrumbs | true | Enables the Yoast breadcrumb component. |
textdomain | ci-replace | Theme text domain (resources/lang). |
preprod_allowed_user_agents | [] | Crawlers still allowed when the site is not public. |
rocket.rocket_change_parameters | true | Applies the rocket.* WP Rocket preload values. |
seo.title_tag | true | Adds title-tag support: WordPress/Yoast print <title>, layouts must not print their own. |
seo.crawl_delay | 0 | Crawl-delay in robots.txt (ignored by Google). |
__()calls in config files run before the theme text domain is loaded (and are frozen byconfig:cache): they only use thedefaultdomain.
config/assets.php
| Key | Default | Description |
|---|---|---|
styles_path / scripts_path | resources/styles/ / resources/scripts/ | Prefix passed to Vite::asset(). |
front_styles / front_scripts | main | Map of main, front-page or a page template file (template-x.blade.php) → file or list of files. First match wins: front page, page template, then main. |
editor_style | ['editor.css'] | Block editor stylesheets. |
login_style | login.css | Login page stylesheet. |
disable_jquery | true | Removes jQuery from the front-end (never the admin). Scripts depending on jquery are dropped too. |
import_jquery_with_gravity_forms | true | Loads jQuery anyway when a Gravity Form is rendered. |
jquery_url | null | null = WordPress' bundled jQuery. A URL opts in to a CDN build. |
jquery_integrity | null | SRI hash (sha384-…) added to the CDN jQuery tag. |
vite_client | from VITE_HOST/VITE_PORT | Vite client loaded in development (WP_ENV=development). |
Handles: the first file of a group is ci_main (front), admin_main (editor), ci_login (login); next
files get _1, _2… suffixes, or use string keys to name them.
Blade directives
| Directive | Description |
|---|---|
@filled($a, $b) … @elsefilled(...) … @endfilled | All arguments non-empty. Compiled to ! empty(), so undefined variables are safe. @unlessfilled also available. |
@anyfilled(...) | At least one argument non-empty (+ else/unless/end variants). |
@notempty(...) / @notallempty(...) | Aliases of @filled / @anyfilled. |
@woopage … @endwoopage | WooCommerce cart, checkout (incl. order received) or account page; false without WooCommerce. |
@wpauth / @wpguest | Logged-in visitor / guest. |
@wpguard | exit when ABSPATH is not defined. |
robots.txt
- Site not public (
blog_publicoff, e.g. pre-production): everything is disallowed, exceptpreprod_allowed_user_agents. - Public site: core rules, plus
Disallowon feeds, trackbacks, the content directory, Gravity Forms uploads,wp-includes,wp-admin,wp-login.php,xmlrpc.phpand*.php|inc|zip|gz|log|ini|po|cgifiles; thenAllowon CSS, JS, images and videos in the content directory. Paths come from the install (Bedrock:/app/,/wp/wp-includes/…). Theadmin-ajax.phpallow line is removed.
Other uploads (PDF, documents…) in the content directory are not crawlable.
Theme scaffold
Published into the theme by the wp-starter-theme tag:
app/:setup.php,filters.php,helpers.php,Providers/ThemeServiceProvider,Options/GeneralOptions(ACF Composer option page), View components.config/:theme.php,assets.php,acf.php,cache.php.resources/views: layout (skip links +<main id="content">),page,front-page,404,template-sitemap(HTML sitemap excluding Yoast noindex posts),template-redirect(redirects to the first published child page).- Components:
<x-layouts.sitemap>(the others are core components, below). vite.config.js,package.json, Tailwind CSS 4 styles (including the design tokens of the core components), TypeScript entry.
The core components (<x-core.section>, <x-core.container>, <x-core.heading>, <x-core.image>,
<x-core.figure>, <x-core.button>, <x-core.wysiwyg>, <x-core.breadcrumb>, <x-core.favicon>,
<x-core.skip-links>) are not part of the scaffold: they come from concept-image/wp-core-ui, required by this package. wp acorn
core-ui:install publishes the missing ones into the theme (app/View/Components/Core,
resources/views/components/core), where they belong to the project; wp acorn core-ui:clean deletes the ones
the theme doesn't use (--dry-run lists them, core-ui:install restores them). The scaffold keeps what they rely
on: the tokens (theme.css), utilities.css, the hocus variant (variant.css), components/wysiwyg.css,
components/breadcrumb.css, the @filled directive and public/favicon/.
Image component
<x-core.image :image="$imageId" size="medium_large" />
<x-core.image :image="$image" width="800" height="600" cover />
<x-core.image :image="$imageId" eager /> {{-- loading=eager, fetchpriority=high --}}
<x-core.image :image="$imageId" :customsrcset="[['medium', '600w'], ['large', '1200w']]" />
Wraps wp_get_attachment_image(). width/height select the closest size; cover adapts to the image
orientation. Images are lazy-loaded by default. alt=false forces an empty alt. See wp-core-ui's README for the
other core components.
Vite
npm install
npm run dev # dev server (HTTPS, VITE_HOST / VITE_PORT from the Bedrock .env)
npm run build # production build in public/build
nginx
The theme sources and uploads protections are Apache .htaccess rules (wp-fortress). On nginx, deny them yourself:
location ~* ^/app/themes/[^/]+/(?!public/|style\.css$|screenshot\.png$) { deny all; }
location ~* ^/app/uploads/.*\.php$ { deny all; }
Known pitfalls
- Any ACF field named
formgets its choices replaced by the Gravity Forms list. disable_jquerydrops every front-end script that depends onjquery.concept-image/wp-queryis required as^1.0andconcept-image/wp-custom-post-typesas^4.2: a 2.0 / 5.0 release needs a constraint bump here.- Without a Vite build (
public/build/manifest.json) or a running dev server, pages throwViteManifestNotFoundException.
Security
Security lives in concept-image/wp-fortress, required by this package: security headers
and CSP, REST restriction, user enumeration, XML-RPC, sanitized SVG uploads, .htaccess rules (theme sources,
PHP in uploads…), firewall and security maintenance. It works alongside SecuPress Pro. After installing, run
wp acorn fortress:install.
Claude Code
Bedrock projects have no Laravel Boost, so the Concept Image packages publish their AI guidance straight into the Bedrock root, where Claude Code loads it on its own. One command publishes all of it:
wp acorn starter:ai # skills, rules and CLAUDE.md; existing files are kept
wp acorn starter:ai --force # after a package update: refresh the skills and rules (never CLAUDE.md)
| Package | Tag | Files (Bedrock root) |
|---|---|---|
| wp-starter-theme | wp-starter-theme-ai (wp-starter-theme-skill + wp-starter-theme-rules) | .claude/skills/wp-starter-theme/, .claude/rules/wp-starter-theme/ |
| wp-acorn-stubs (when installed, dev only) | wp-acorn-stubs-ai | .claude/skills/wp-acorn-stubs/, .claude/rules/wp-acorn-stubs/ |
| wp-ajax | wp-ajax-ai | .claude/skills/wp-ajax/, .claude/rules/wp-ajax/ |
| wp-archive-base | wp-archive-base-ai | .claude/skills/wp-archive-base/, .claude/rules/wp-archive-base/ |
| wp-blocks | wp-blocks-ai | .claude/skills/wp-blocks/, .claude/rules/wp-blocks/ |
| wp-core-ui | wp-core-ui-ai | .claude/skills/wp-core-ui/, .claude/rules/wp-core-ui/ |
| wp-cron | wp-cron-ai | .claude/skills/wp-cron/, .claude/rules/wp-cron/ |
| wp-custom-post-types | wp-custom-post-types-ai | .claude/skills/wp-custom-post-types/, .claude/rules/wp-custom-post-types/ |
| wp-fortress | wp-fortress-ai | .claude/skills/wp-fortress/, .claude/rules/wp-fortress/ |
| wp-make-block (when installed, dev only) | wp-make-block-ai | .claude/skills/wp-make-block/, .claude/rules/wp-make-block/ |
| wp-make-cpt (when installed, dev only) | wp-make-cpt-ai | .claude/skills/wp-make-cpt/, .claude/rules/wp-make-cpt/ |
| wp-query | wp-query-ai | .claude/skills/wp-query/, .claude/rules/wp-query/ |
| wp-roles | wp-roles-ai | .claude/skills/wp-roles/, .claude/rules/wp-roles/ |
| wp-smtp | wp-smtp-ai | .claude/skills/wp-smtp/, .claude/rules/wp-smtp/ |
| wp-starter-theme | wp-starter-theme-claude-md | CLAUDE.md |
A package is skipped when its provider isn't loaded (wp-make-block, wp-make-cpt and wp-acorn-stubs in production), or when the installed version
has no Claude Code tag yet. The rules are loaded by path: wp-starter-theme.md always, the others for the theme's
hooks and providers, components and views, config/theme.php / config/assets.php, assets and tests.
CLAUDE.md is a stub for the project: stack and skills, commands, a section for project notes, and the workflow
for package bugs (fix them in the package repository, never in vendor/concept-image/*). It is published only
when missing: starter:ai never overwrites it, even with --force.
Theme tests and quality tools
The scaffold publishes a test suite and quality tools into the theme: tests/, phpunit.xml.dist,
pint.json, phpstan.neon.dist and an empty phpstan-baseline.neon.
The tests run against the live site and database of the current environment. There is no test database:
tests are read-only (no factories, no RefreshDatabase, no writes). Run them inside the project container,
where the database is reachable.
| File | Covers |
|---|---|
Feature/SmokeTest.php | Front page 200, unknown URL 404 (theme template), robots.txt; no PHP error displayed or logged by the theme; layout (<title> once, #content); every local CSS/JS asset served; no Vite dev server outside development; search 404 when disabled |
Feature/PageTemplatesTest.php | Every Blade view compiles to valid PHP; declared page templates exist; every published page (50 max) and one page per template answer 200/301/302 without PHP error |
Feature/WordPressTest.php | Installed, this theme active, Bedrock URLs and environment, pretty permalinks, static front page, ACF active, indexable only in production |
Feature/SecurityTest.php | File editing disabled, no displayed errors outside development, no guessable admin logins, theme sources / .env / composer.json not served, no directory listing, composer audit clean, no pending semver-compatible update of the theme dependencies; with wp-fortress: security headers, users hidden from guests (REST, ?author=), XML-RPC refused, fortress:htaccess --check |
Feature/BrowserTest.php | No JavaScript error on the front and 404 pages (skipped until Pest browser testing is installed) |
ArchTest.php | No debug calls; services don't register hooks; hook classes use attributes; view components extend Component |
PHP errors count when they come from the theme (its code or concept-image/* packages), or when they are fatal
wherever they come from. Third-party plugin notices don't fail the suite.
Setting up a new project
From the theme directory, inside the project container:
composer config allow-plugins.pestphp/pest-plugin true
composer require --dev "pestphp/pest:^4.0|^5.0" "phpstan/phpstan:^2.1" \
"szepeviktor/phpstan-wordpress:^2.0" "php-stubs/acf-pro-stubs:^6.0"
Add these scripts to the theme composer.json:
"scripts": {
"lint": "pint",
"test:lint": "pint --test",
"analyse": "phpstan analyse --memory-limit=1G",
"analyse:baseline": "phpstan analyse --generate-baseline --memory-limit=1G",
"test": "pest",
"ci": ["@test:lint", "@analyse", "@test"]
}
Publish the scaffold, the core components and the Claude Code files first, from the Bedrock root:
wp acorn starter:install # vendor:publish --tag=wp-starter-theme, core-ui:install, ajax:install, archive:install, starter:ai
Then, once all packages have published their files:
composer lint # format the published code once (Pint, Laravel preset)
composer analyse:baseline # record the existing PHPStan issues of code published by other packages
composer ci # Pint, PHPStan level 5, Pest: green
Notes:
vendor:publish --tag=wp-starter-theme --forcealso overwritesphpstan-baseline.neonwith the empty one: runcomposer analyse:baselineagain after a forced publish.- The Bedrock root
pint.json(PER preset) must exclude the theme (web/app/themes/<theme>); otherwise both configurations reformat the same files back and forth. - The bootstrap (
tests/bootstrap.php) loads Bedrock's autoloader before the theme's, as in production. That way the root's own Pest/PHPUnit never shadows the theme's. - JavaScript errors:
composer require --dev pestphp/pest-plugin-browser,npm install --save-dev playwright && npx playwright install chromium. The container also needs Chromium's system libraries (npx playwright install-deps, as root, in the Docker image).
Development
composer install
composer lint # Pint (fix)
composer test:lint # Pint (check)
composer analyse # Larastan + WordPress stubs, level 5
composer test # Pest
composer ci # the three checks
The tools need PHP 8.3+ with the dom, xml and mbstring extensions. Without them, run them in Docker:
docker run --rm -u "$(id -u):$(id -g)" -v "$PWD":/app -w /app composer:2 composer ci
- Tests run on Testbench (Laravel container, config, Blade) with Brain Monkey
for WordPress functions and hooks (
add_action/add_filterexpectations,Functions\when()stubs). WordPress core classes (WP_Query,WP_Error,WP_Admin_Bar) and plugin APIs (Gravity Forms, WP Rocket) are stubbed intests/Stubs. UsestubWp(['function' => $return])andsetEnvironment('production')fromtests/Pest.php. - PHPStan reads the WordPress stubs without executing them (they would redeclare Laravel's
__()), plustests/Stubs/plugins.phpandtests/Stubs/woocommerce.stub.phpfor plugin APIs. - Arch tests enforce strict types, final hook modules, the
Hookcontract, and no hook registration in services.
Upgrading
Migrating a project from 5.x? Follow UPGRADE.md.
Changelog
Please refer to CHANGELOG for more information.
Contributing
Please refer to CONTRIBUTING for more information.
License
Please refer to LICENSE for more information.
Credits
- Banner icon: Color palette icons created by Magnific - Flaticon