Thanks for your interest in contributing. This guide covers how to set up a development environment, the rules around generated code, how to write commits, and how to get a pull request merged.
By participating in this project you agree to abide by the Code of Conduct.
- Report bugs or request features via GitHub Discussions.
- Report security vulnerabilities privately — see SECURITY.md. Do not open public issues or PRs for security reports.
- Submit code changes via pull request (this document).
- Improve documentation at magewirephp/magewire-docs.
- PHP 8.2+
- Composer 2
- Node.js 20+ (for Tailwind compilation)
- Git
- A working Magento 2 installation for integration testing
git clone https://github.com/magewirephp/magewire.git
cd magewire
composer install
npm installComposer install wires up CaptainHook automatically. The hooks enforce:
pre-commit— runsvendor/bin/portman buildsodist/stays in sync.commit-msg— validates Conventional Commits format.
| Directory | Description | Edit? |
|---|---|---|
src/ |
Magento module (controllers, blocks, DI, templates, layout XML) | ✅ |
lib/Magewire/ |
Hand-written Magewire core (Mechanisms, Features, Containers) | ✅ |
lib/MagewireBc/ |
Backwards compatibility layer (v1 → v3 migration) | ✅ |
lib/Magento/ |
Magento framework extensions (Magewirephp\Magento\ namespace) |
✅ |
lib/Symfony/ |
Symfony utility imports (Magewirephp\Symfony\ namespace) |
✅ |
lib/Livewire/ |
Downloaded Livewire source cache | ❌ |
dist/ |
Portman-generated output (ported + merged Livewire code) | ❌ |
portman/Livewire/ |
Augmentation files merged into ported Livewire source | ✅ |
themes/ |
Theme compatibility modules (Hyvä, Luma, Breeze, Backend) | ✅ |
dist/ is generated by Portman from lib/Livewire/ (upstream cache) plus portman/Livewire/ (our augmentations). To modify code that lives in dist/:
- Create or edit the matching file in
portman/Livewire/(mirror the Livewire source structure). - Run
vendor/bin/portman build. - The result lands in
dist/under theMagewirephp\Magewire\namespace.
vendor/bin/portman watch rebuilds on save while you work.
To bump Livewire version, change version-lock in portman.config.php and rebuild.
Two toolchains, two scopes:
| Tool | Scope | Command |
|---|---|---|
mago |
lib/, src/, themes/ (hand-written code) |
mago lint, mago format |
php-cs-fixer |
dist/ only (generated code) |
vendor/bin/php-cs-fixer fix dist/ |
rector |
dist/ only |
vendor/bin/rector process dist/ |
Mago formatter preset: PSR-12, single quotes, 200 char print width, sort-uses enabled. See mago.toml for the full rule set.
Run before opening a PR:
mago lint
mago format
vendor/bin/portman build
vendor/bin/php-cs-fixer fix dist/Conventional Commits — enforced by the commit-msg hook.
Format: <type>(<scope>): <subject>
Common types: feat, fix, chore, docs, refactor, test, perf, ci.
Examples:
feat(compiler): add @render.parent directive
fix(snapshot): handle null property reassignment
chore(portman): bump Livewire to 3.7.12
Breaking changes — append ! after the type/scope and add a BREAKING CHANGE: footer:
feat(component)!: drop deprecated mount() signature
BREAKING CHANGE: Components must now implement boot() instead of mount().
Release-please uses these to cut version bumps and generate CHANGELOG.md.
- Fork and branch from
main. Name the branch after the change (e.g.fix/snapshot-null-guard). - Keep PRs focused — one concern per PR.
- Update or add a skill under
.claude/skills/if your change alters a documented API or pattern. - Include a description explaining why, not just what — the diff shows the what.
- Link relevant discussions or issues.
- CI will re-run
portman buildon your PR and auto-commitdist/changes, so you don't need to includedist/diffs if you don't want to. But committing them locally first avoids conflicts.
- Edits to
dist/,lib/Livewire/, ornode_modules/. - Commits with non-Conventional-Commit messages.
- Runtime behavior changes without a matching update to the relevant skill doc under
.claude/skills/. - Changes that skip
mago format/php-cs-fixer.
cd tests/Playwright
cp .env.example .env # configure BASE_URL + credentials
npm install && npx playwright install
npx playwright test # headless
npx playwright test --ui # interactive
npx playwright test tests/example.spec.ts # single fileRequires Magento with Sample Data installed. Fixtures provide guest, customer, admin, and API browser contexts.
Install the module into a real Magento 2 project via Composer path repository during development:
{
"repositories": [
{ "type": "path", "url": "/path/to/magewire" }
],
"require": { "magewirephp/magewire": "*" }
}The .claude/skills/ tree contains deep-context reference files that agents and contributors can load on demand. If you add, remove, or significantly change a public API — component lifecycle, directive, Feature registration, snapshot shape — update the matching skill. Keep skills and code in lockstep.
Core skills (theme-agnostic):
magewire— component API, lifecycle hooks,wire:*directivesmagewire-architecture— Mechanisms, Features, snapshot flow, DI patternsmagewire-javascript— CSP-compatible JS, Alpine.js integrationmagewire-portman— Portman workflow, augmentation filesmagewire-best-practices— component/template/DI/events/security rulesmagewire-theming— building theme compatibility modulesmagewire-backwards-compatibility— v1 → v3 BC layer
Automated via release-please. On merge to main with Conventional Commits, release-please opens a release PR that bumps the version and updates CHANGELOG.md. Merging the release PR tags and publishes to Packagist.
Manual release steps should never be needed. If release-please misbehaves, open a discussion.
By contributing, you agree your contributions will be licensed under the MIT License.