Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
6e1d85f
Refactor type parser to replace custom parser logic with dedicated co…
le0daniel Jul 27, 2026
071e320
Refactor parser to replace `TypeStringTokenizer` with `Lexer` and `Le…
le0daniel Jul 27, 2026
718e49e
Add value object parsing and serialization, including brand support f…
le0daniel Jul 28, 2026
fc868c4
Add `DateTimeString` type support with parsing, serialization, valida…
le0daniel Jul 28, 2026
90c0beb
Refactor utilities by introducing `Dicts` and `Lists` classes, replac…
le0daniel Jul 28, 2026
55027a1
Add `TypescriptGenerator` implementation with support for branded typ…
le0daniel Jul 28, 2026
0d82912
Add `TypescriptGenerator` implementation with support for branded typ…
le0daniel Jul 28, 2026
1b96507
Remove deprecated `TypescriptDefinitionGenerator` and `DefinitionTarg…
le0daniel Jul 28, 2026
4065c10
Refactor `ArrayConsumer` to remove unnecessary array type check and u…
le0daniel Jul 28, 2026
2ac8e28
Fixed hashing
le0daniel Jul 28, 2026
a54bdeb
Refactor built-in types by replacing `BuiltInNode` and `BuiltInType` …
le0daniel Jul 28, 2026
a75dcb7
Replace `ClientAwareException` with `ExposeAs` attribute; refactor `C…
le0daniel Jul 28, 2026
21746d0
Remove `Branded`, `NamedNode`, and `Options` classes; refactor tests …
le0daniel Jul 28, 2026
a93e128
Remove `AstSorter` class; refactor to use `ASTOptimizer` for AST sort…
le0daniel Jul 29, 2026
0105ece
Add `@throws \JsonException` annotation to `stringLiteral` method in …
le0daniel Jul 29, 2026
bc907e4
Add `TypescriptFile` and `TypescriptImport` classes to handle TypeScr…
le0daniel Jul 29, 2026
9c51865
Remove deprecated `TypescriptCodeBlock`, `TypescriptImportStatement`,…
le0daniel Jul 29, 2026
b291f3e
Add toast handling and directive management for SPA clients using `Se…
le0daniel Jul 29, 2026
1bdd160
Introduce `MiddlewareContract` and `InvalidMiddlewareException`; enforce
le0daniel Jul 29, 2026
8d5dac7
Refactor `TypedOperation` instantiation and error type generation; im…
le0daniel Jul 29, 2026
9753347
Add `fullyQualifiedHandler` metadata to response in `LocalMetadataMid…
le0daniel Jul 29, 2026
030df6d
Add `idLength` support for operation caching; update configuration, c…
le0daniel Jul 29, 2026
83df98f
Renamed Registry
le0daniel Jul 29, 2026
d606598
Moved interfaces
le0daniel Jul 29, 2026
b536c2f
Moved interfaces
le0daniel Jul 29, 2026
1b1ee03
Merge remote-tracking branch 'origin/feature/remove-old-parsers-and-c…
le0daniel Jul 29, 2026
a88cfb6
Fixed PHPStan
le0daniel Jul 31, 2026
a05b491
Consolidate error presenters into a single `ErrorPresenter` class; re…
le0daniel Jul 31, 2026
56aafd6
Refactor constraints by replacing `Email`, `Length`, `NonEmptyString`…
le0daniel Jul 31, 2026
8a05057
Fix typo in `ValueObjectConsumer` class docblock.
le0daniel Jul 31, 2026
ed5d5e6
Remove `Result` interface and its implementations; refactor usages to…
le0daniel Jul 31, 2026
42f8f95
Add mocks for value objects with inherited metadata to support compre…
le0daniel Jul 31, 2026
93a765f
Add support for naming aliases per direction; update parsing and code…
le0daniel Jul 31, 2026
ce65cf2
Add ArtisanOptions helper and unit tests; update `OptimizeCommand` to…
le0daniel Jul 31, 2026
6c7c0e0
Move `Parser\Exceptions` to `Parser\Data\Exceptions`; update referenc…
le0daniel Aug 3, 2026
d5278e4
Move `Parser\Consumers` to `Parser\Helpers\Consumers`; update namespa…
le0daniel Aug 3, 2026
ef0fc5c
Restructure namespaces by moving `Parser` components to `Parser\Helpe…
le0daniel Aug 3, 2026
c4290f1
Refactor `EmitTanstackQuery` to use `EmitOperations` for consistent n…
le0daniel Aug 3, 2026
c5dbe46
Remove unused `Paths` import from `EmitTanstackQuery`.
le0daniel Aug 3, 2026
2bbf9ff
Refactor imports in `EmitOperations` and `EmitQueryKey` to use dedica…
le0daniel Aug 3, 2026
6daad43
Add dependency injection for EmitTypes and EmitOperationClientBinding…
le0daniel Aug 4, 2026
7b0445f
Remove `TYPE_MAP` and dependency injection from `EmitTypeMap`; update…
le0daniel Aug 4, 2026
7bad119
Add dependency management for `EmitTypes` in `EmitTypeMap`; implement…
le0daniel Aug 4, 2026
130e5a5
Update `EmitQueryKey` to handle operations with and without input; mo…
le0daniel Aug 4, 2026
8274145
Refactor `LaravelServiceProvider` to simplify caching logic; update `…
le0daniel Aug 4, 2026
729ded5
Add comprehensive unit tests and improve multiline declaration parsin…
le0daniel Aug 4, 2026
6931cfb
Add comprehensive unit tests and improve multiline declaration parsin…
le0daniel Aug 4, 2026
c3af968
Update `config.php` to enhance cache key configuration, clarify comme…
le0daniel Aug 4, 2026
ec1cef9
Refactor `ContextFactory` to clarify PHPDoc comments; add DI for `Loc…
le0daniel Aug 4, 2026
375c235
Refactor `Server` to use `ServerAdapter` for middleware and controlle…
le0daniel Aug 4, 2026
84e20ae
Add `LocalMetadataMiddleware` in debug mode; refactor middleware regi…
le0daniel Aug 4, 2026
9b512dc
Expand `README.md` with detailed documentation on `ServerAdapter`, `S…
le0daniel Aug 4, 2026
9cd0401
Add `RenamingMiddleware` and enhance error naming logic for `#[Throws…
le0daniel Aug 4, 2026
fed2b3b
Make the executor fail loudly instead of degrading silently
le0daniel Aug 4, 2026
5e24b84
Reject bare array, and fix two silent misresolutions
le0daniel Aug 4, 2026
87e142f
Close the gaps in the server's error and naming contracts
le0daniel Aug 4, 2026
b9965e1
Mark generated files, and fix the generated client's timeouts and typing
le0daniel Aug 4, 2026
750bcaf
Make the core standalone in packaging, not just in code
le0daniel Aug 4, 2026
34bec23
Bring the docs back in line with what the library does
le0daniel Aug 4, 2026
b484bc1
Add detailed documentation for Laravel adapter, update `README.md` re…
le0daniel Aug 4, 2026
550ad11
Add `OperationSPAClient` Typescript generator and update client typin…
le0daniel Aug 5, 2026
6dced5a
Remove `LocalMetadataMiddleware` and refactor error handling logic fo…
le0daniel Aug 5, 2026
82ef23b
Add comprehensive test coverage for `RpcError` and `RpcSuccess` JSON …
le0daniel Aug 5, 2026
a11ca4b
Add full-length documentation for directives, errors, server configur…
le0daniel Aug 5, 2026
63d7453
Align TypeScript client documentation tables with updated headers and…
le0daniel Aug 6, 2026
0c1f13b
Introduce `ValidationException` for enhanced value object rejection h…
le0daniel Aug 6, 2026
07a74dd
Refactor and simplify code generation with `CodeGenerators` utility a…
le0daniel Aug 6, 2026
8f516fc
Add tests for `CodeGenerators` and `CodeGenCommand` with custom namin…
le0daniel Aug 6, 2026
646392a
Force rules
le0daniel Aug 6, 2026
2784776
Improve type safety and parsing logic in `UnionHandler` and optimize …
le0daniel Aug 6, 2026
22ceed2
Add CI workflow and apply standardized formatting across the codebase
le0daniel Aug 6, 2026
ebb58e2
Remove `Reflections` utility and its associated tests
le0daniel Aug 7, 2026
c393224
Refactor error handling to introduce `domainErrors`, enhance TypeScri…
le0daniel Aug 7, 2026
9b57803
Add `OutputDirectory::clear` and `Assertions::true` for safer directo…
le0daniel Aug 10, 2026
6b88ce5
Refactor `OutputDirectory` for safer file handling and improved direc…
le0daniel Aug 10, 2026
c8e9f32
Introduce `ClientFactory` for configurable client creation and update…
le0daniel Aug 10, 2026
2169051
Standardize method formatting in `LaravelServiceProvider::serverFacto…
le0daniel Aug 10, 2026
472037f
Add extensive unit tests and mock classes for error handling and doma…
le0daniel Aug 11, 2026
c823f49
Remove `ErrorPresenter` and `ExposedExceptions` classes, along with r…
le0daniel Aug 11, 2026
e13597a
Enhance `CLIENT_ERROR` handling in TypeScript client to include raw H…
le0daniel Aug 11, 2026
d5c50aa
Update `README.md` to clarify library goals, expand architecture deta…
le0daniel Aug 12, 2026
ae9939a
Add `RATE_LIMITED` error category with RetryIn resolver, update error…
le0daniel Aug 12, 2026
0ebaffc
Remove `NodeInterface` from `EnumNode` and `ValueObjectNode` to simpl…
le0daniel Aug 12, 2026
414631f
Implement `RecordKey` helper for record key validation and serialization
le0daniel Aug 13, 2026
46736a3
Add mock and test classes to improve coverage for parsing and reflect…
le0daniel Aug 13, 2026
4b3d9a9
Add `CachedOperationRegistry` tests and optimize memoization logic in…
le0daniel Aug 13, 2026
0c98fee
Rename `registryKey` to `fullyQualifiedOperationKey` for consistency …
le0daniel Aug 13, 2026
2524f46
Update terminology to replace `{fqn}` with `{key}` for operation keys…
le0daniel Aug 13, 2026
3518f19
Add support for dynamic context in `preloadMany` via closure evaluation
le0daniel Aug 13, 2026
1307c6d
Add integration test fixtures and casting logic for operations and va…
le0daniel Aug 13, 2026
88a18fc
Improve tuple parsing logic, error messaging, and test coverage in `A…
le0daniel Aug 13, 2026
9adb553
Update `Sku` to support dynamic Brand attribute and fix return type i…
le0daniel Aug 13, 2026
405affd
Refactor `CartCommands` and `CheckoutCommands` to improve type annota…
le0daniel Aug 13, 2026
a5361a4
Add input validation to `parcelDimensions` query in `OrderQueries` to…
le0daniel Aug 13, 2026
3430ed6
Update `OrderQueries` type annotation to
le0daniel Aug 13, 2026
af8b9c1
Add new integration fixtures and test suites for casting, alias resol…
le0daniel Aug 14, 2026
fcd131f
Add benchmark script to measure performance of cached vs eager operat…
le0daniel Aug 14, 2026
ce72244
Add end-to-end benchmark for full request lifecycle
le0daniel Aug 14, 2026
e4a3264
Add `NoOpMiddleware` and integrate middleware into `CartCommands`
le0daniel Aug 14, 2026
2b022d0
Add support for per-operation middleware configuration
le0daniel Aug 14, 2026
ca40018
Refactor client execution flow to centralize response handling
le0daniel Aug 14, 2026
3464f8c
Add `MetadataMiddleware` and integrate with `ShippingCommands`
le0daniel Aug 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches:
- main
- 'feature/**'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
name: Tests, static analysis, style & TypeScript
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Setup PHP 8.5
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
# No coverage is configured in phpunit.xml, so skip Xdebug/PCOV entirely.
coverage: none

# Needs no vendor tree, so it runs before install and fails fast on a lock desync.
- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Install PHP dependencies
uses: ramsey/composer-install@v3

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '24'
cache: npm
cache-dependency-path: tests/ts-output/package-lock.json

- name: Pest, PHPStan and Pint
run: composer run check:all

# The Pest suite proves the generators emit exactly the committed fixture; this proves that
# fixture still compiles.
- name: Typecheck the generated TypeScript
run: composer run check:ts
17 changes: 17 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# PHP

- Always use PHP8.5, which is the minimum version this library supports.
- Use the pipe operator when possible.
- Mark Closures as `static` when possible.
- Use `readonly` properties when possible.
- Trust PHPstan. This library is designed to be used with PHPStan (preferably with strict level >= 8).
- Type your code as good as possible. Mixed only when necessary.

## Development

Split the work into small units. For each unit:

1. Write tests first
2. Check if tests fail
3. Implement the change
4. Verify, correct and iterate
655 changes: 511 additions & 144 deletions README.md

Large diffs are not rendered by default.

52 changes: 44 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
{
"name": "le0daniel/php-ts-bindings",
"description": "Library to create type bindings between PHP8 and TS, supporting parsing, serialization and emitting of TS types for PHP objects/input strongly typed",
"description": "Type-safe RPC between a PHP 8.5 backend and a TypeScript frontend, driven by your PHPStan types.",
"type": "library",
"license": "MIT",
"keywords": [
"rpc",
"typescript",
"phpstan",
"code-generation",
"type-safety",
"laravel"
],
"require": {
"php": "^8.4"
"php": "^8.5"
},
"require-dev": {
"pestphp/pest": "4.x-dev",
"phpstan/phpstan": "2.1.x-dev",
"laravel/framework": "^11|^12",
"pestphp/pest": "^v4.7.0",
"phpstan/phpstan": "^2.1",
"laravel/framework": "^13",
"mockery/mockery": "^1.6",
"phpstan/phpstan-strict-rules": "^2.0"
"phpstan/phpstan-strict-rules": "^2.0",
"psr/container": "^2.0",
"laravel/pint": "^1.30"
},
"suggest": {
"laravel/framework": "Enables the first-party Laravel adapter: config, routes, and the operations:* artisan commands.",
"phpstan/phpstan": "Include vendor/le0daniel/php-ts-bindings/extension.neon so Pick, Omit, BrandedString, BrandedInt and DateTimeString resolve.",
"psr/container": "Required only by PsrContainerAdapter. Install it to resolve handlers and middleware through a PSR-11 container; the default NewInstanceAdapter needs nothing."
},
"autoload": {
"psr-4": {
Expand All @@ -37,10 +53,30 @@
"scripts": {
"test": "pest",
"check:types": "phpstan --memory-limit=1G analyse",
"check:style": "pint --test",
"fix:style": "pint",
"check:all": [
"@test",
"@check:types"
]
"@check:types",
"@check:style"
],
"check:ts": [
"npm ci --prefix tests/ts-output --no-audit --no-fund",
"npm --prefix tests/ts-output run typecheck"
],
"codegen:fixture": [
"@php tests/ts-output/generate.php",
"npm --prefix tests/ts-output install --no-audit --no-fund",
"npm --prefix tests/ts-output run typecheck"
],
"benchmark": "@php tests/benchmark/run.php"
},
"scripts-descriptions": {
"check:style": "Check formatting with Pint (psr12) without writing. Run fix:style to apply.",
"fix:style": "Apply Pint formatting in place.",
"check:ts": "Typecheck the committed generated TypeScript with tsc --noEmit. Needs node; check:all does not.",
"codegen:fixture": "Regenerate tests/ts-output/generated and typecheck it with tsc --noEmit. Run after changing a code generator; commit the result.",
"benchmark": "Time cached vs eager operation registries over the integration fixtures. Informational; not part of check:all or CI."
},
"extra": {
"laravel": {
Expand Down
Loading
Loading