Thanks for considering a contribution. The project follows a few simple conventions; please respect them and the review will be smooth.
git clone https://github.com/endless-creativity/elephant-php.git
cd elephant-php
composer install
composer test # Pest
composer stan # PHPStan level 8
composer format # Laravel PintCI runs the same three checks on PHP 8.2 / 8.3 / 8.4 / 8.5. A PR that fails any of them won't be merged.
- Test-driven: a behavioural change without a Pest test that fails
before and passes after will be asked back. Use one of the existing
fixtures under
tests/fixtures/when possible, or add a new one. declare(strict_types=1)in every PHP file.final readonly classfor value objects; named arguments for constructors with three+ parameters.- Mammoth fidelity first. The library is a faithful port of
mammoth.js; when in
doubt about an edge case, look at how mammoth handles it in
./reference/mammoth.js/(gitignored — clone it locally) and replicate. Each ported file carries a// Ported from mammoth.js: …header comment for traceability. Deviations from mammoth must be intentional, justified in the commit message, and documented inROADMAP.md. - Conventional commits (
feat:,fix:,chore:,docs:,test:,refactor:).
Please include:
- The smallest
.docxthat reproduces the issue (or the raw XML fragment if you'd rather not share the document). - The expected vs actual HTML / Markdown output.
- The conversion warnings from
$result->messages.
The project is pre-1.0. The public API (Converter, Result,
Message, MessageType, StyleMap, ImageHandler) will become
stable at 1.0; the internal namespaces (Reader\*, Document\*,
Html\*, Style\* non-API surface) are implementation details and
may move. See ROADMAP.md for what's still missing vs mammoth.