feat(php): add native PHP implementation and composer package - #285
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #284
- add php/README.md and php/README.ru.md - link the PHP implementation from the root READMEs - add examples/php/quick_start.php covering every documented snippet - add .github/workflows/php.yml (lint, test matrix 8.1-8.4, Packagist publish, release) - note the PHP implementation in CHANGELOG.md
links-notation package in composer
Working session summaryThe PHP port is complete and PR #285 is ready for review: #285 What landed (3 commits on
CI on the pushed head One thing worth your decision: publishing to Packagist needs This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $7.870472📊 Context and tokens usage:Claude Opus 5: (3 sub-sessions)
Total: (4.4K new + 236.5K cache writes + 6.4M cache reads) input tokens, 90.9K output tokens, $7.870472 cost 🤖 Models used:
📎 Log file uploaded as Gist (2813KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit bc1fbd2.
Closes #284
Adds a native PHP implementation of Links Notation and prepares the
link-foundation/links-notationpackage for Composer/Packagist, following thestructure of the existing JavaScript, Python, Rust, Go, Java and C# ports.
What is added
php/src/— native port of the parser and formatter:Parser— full lino parser (inline links, parenthesized groups, significantindentation, indented-id syntax, multi-quote strings, multiline quoted
references, nested indentation contexts inside parentheses per Indentation is structural at the root but ignored inside ( ), so parenthesised groups cannot express nested records #282), with
input size and depth limits
Link— link data structure (format,equals,simplify,combine,escapeReference, …)Formatter— document formattingFormatConfig— formatting options (line length, inline ref count,grouping, indent string, prefer-inline)
ParseException— parse error typephp/composer.json— Composer packagelink-foundation/links-notation(PSR-4
LinkFoundation\LinksNotation\, PHP >= 8.1,ext-mbstring,Unlicense, version
0.1.0) withtest,lintandlint:fixscriptsphp/tests/— PHPUnit suite ported 1:1 from the Python test suite.github/workflows/php.yml— lint (PSR-12 via PHP_CodeSniffer), test matrixon PHP 8.1/8.2/8.3/8.4, Packagist publish (skipped when the version is
already published or when the Packagist secrets are absent) and GitHub
release with the repo-standard
php_<version>tagphp/README.md,php/README.ru.md, PHP entries in the rootREADME.md/README.ru.md, and aCHANGELOG.mdnoteexamples/php/quick_start.php— runnable version of every README snippetHow to reproduce / verify
Automated tests
The PHP suite is a direct port of the Python one, so behaviour parity is
checked rather than assumed: single-line parsing, nested parsing, multiline
documents, multi-quote strings, multiline quoted strings, edge cases, nested
indentation (#282), nested self-references, indented-id syntax, indentation
consistency, mixed indentation modes,
Link/FormatConfigunit tests and APItests.
Local run:
OK (173 tests, 469 assertions),phpcsclean.Packagist note
Repository release tags use the
php_<version>format, which Packagist cannotparse as a version, so
composer.jsonkeeps an explicitversionfield and CIvalidates with
composer validate --strict --no-check-version. Publishingrequires the
PACKAGIST_USERNAMEandPACKAGIST_TOKENrepository secrets; thepublish step is skipped with a message when they are not configured.