Skip to content

Stdlib: json_encode + examples/004-ApiJson (closes #61, #270)#389

Merged
PurHur merged 2 commits into
masterfrom
issue-61-270-json-api
May 20, 2026
Merged

Stdlib: json_encode + examples/004-ApiJson (closes #61, #270)#389
PurHur merged 2 commits into
masterfrom
issue-61-270-json-api

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 20, 2026

Summary

  • Implement json_encode() for assoc arrays with scalar values (VM via PHP delegation, JIT/AOT via __compiler_json_encode_hashtable).
  • Add string-key bool/long storage for JIT hashtables (__hashtable__setStringKeyBool / setStringKeyLong in HashTableHelper).
  • Ship examples/004-ApiJson as a lint-clean JSON API demo and register it in ExamplesCompileTest.

Test plan

  • vendor/bin/phpunit --filter json_encode test/compliance/
  • vendor/bin/phpunit test/unit/ExamplesCompileTest.php
  • ./phpc build -o /tmp/api examples/004-ApiJson/example.php && /tmp/api → valid JSON body
  • Docker CI subset: ExamplesCompileTest|json_encode

Closes #61
Closes #270

Made with Cursor

Ship VM delegation via VmJson, LLVM JIT/AOT encoding for string-key
assoc arrays (bool/int/string/null), string-key bool storage in
hashtables, and a lint-clean JSON API example wired into ExamplesCompileTest.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve Module.php (json_encode + web_* params) and regenerate bootstrap docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit d88f4da into master May 20, 2026
1 check passed
@PurHur PurHur deleted the issue-61-270-json-api branch May 20, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Examples: 004-ApiJson — minimal JSON API endpoint (lint-first) Stdlib: json_encode and json_decode for API endpoints

1 participant