diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..6866514 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,25 @@ +--- +name: Bug report +about: Something isn't working as expected +labels: bug +--- + +**What happened?** + +A clear description of the bug. + +**What did you expect to happen?** + +**Steps to reproduce** + +1. +2. +3. + +**PHP version** + +(e.g. `php -v`) + +**Anything else?** + +Minimal repro code, stack trace, or a link to a branch/gist if you have one. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..ebc4523 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +labels: enhancement +--- + +**What problem are you trying to solve?** + +**Proposed solution** + +**RSC parallel** + +This project ports React Server Components ideas to PHP. If your request +maps to something React/RSC already has a name for, say what it's called +there — it helps figure out whether we're porting a concept or inventing +something new. + +**Anything else?** + +Alternatives you've considered, links, or examples. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..422f09b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,24 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.0] - 2026-07-07 + +### Added + +- Server components and a streaming HTML renderer. +- Suspense streaming via PHP Fibers, with nested and parallel boundaries. +- Error boundaries that catch subtree errors, sync or while streaming. +- Server actions: plain `
` submissions, JSON `fetch` calls, and `redirect()`. +- Client components ("islands") that mount a React island into server-rendered markup. +- A Flight-style JSON endpoint for client-driven navigation without a reload. +- Streaming Flight payloads as NDJSON, using the same scheduler as HTML streaming. +- `cache()` for per-request memoization of data loading. +- Head and metadata hoisting for ``, `<meta>`, and `<link>`. +- Router UX: prefetch-on-hover and a pending indicator during navigation. +- An `examples/todo` app demonstrating every capability above. +- A Docusaurus documentation site, deployed to GitHub Pages. +- CI: PHPStan, PHPUnit, and a client build check. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5dbace7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,48 @@ +# Contributing + +## Project status + +phpx-server is experimental. It exists to answer one question: *how much of the +React Server Components model is portable to PHP?* The API may change as that +question gets answered. Keep that in mind before investing in a large PR — +open an issue first if you're planning something big. + +## Setup + +```bash +composer install +``` + +Run the checks before opening a PR: + +```bash +composer test # PHPUnit +composer analyse # PHPStan, level 5 (see phpstan.neon) +``` + +## Example app + +The `examples/todo` app exercises every capability in the README (streaming, +Suspense, server actions, client islands, Flight navigation). Building it +needs Node and pnpm; running it only needs PHP. + +```bash +composer example:build # installs + builds the React island, compiles .phpx +composer example:serve # http://localhost:8080 +``` + +## Pull requests + +- Add tests for any behavior change. Bug fixes should include a test that + reproduces the bug. +- `composer analyse` must be clean. +- CI must be green. +- Keep PRs small and focused on one change. Large, multi-purpose PRs are + harder to review and more likely to be asked to split up. +- Match the existing code style — don't reformat or restructure code you + aren't otherwise touching. + +## Discussion + +Use GitHub issues for bug reports, feature ideas, and questions about +direction. There's no separate mailing list or chat.