Skip to content

Commit 8a0da89

Browse files
committed
chore: genesis baseline for reviewable dev history
Flatten opaque incremental dev history into a single canonical baseline. Establish package boundaries, shared test bootstrap, and documentation scaffolding fit for external review.
0 parents  commit 8a0da89

28 files changed

Lines changed: 1416 additions & 0 deletions

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.gitattributes export-ignore
2+
.gitignore export-ignore
3+
/composer.lock export-ignore
4+
/tests export-ignore
5+
/.github export-ignore

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ci-${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
package:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout source
18+
uses: actions/checkout@v5
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: '8.3'
24+
coverage: none
25+
26+
- name: Install package dependencies
27+
run: composer install --no-interaction --prefer-dist
28+
29+
- name: Validate composer metadata
30+
run: composer validate --no-check-lock --no-plugins
31+
32+
- name: Run PHPStan
33+
run: composer run phpstan
34+
35+
- name: Run fast package tests
36+
run: composer run test:unit

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/vendor
2+
/composer.lock
3+
/docs
4+
/runtime
5+
/tests/.phpstan.cache
6+
/tests/.phpunit.cache
7+
/tests/coverage
8+
.DS_Store

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 switon.dev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Switon Invoker Package
2+
3+
[![CI](https://img.shields.io/github/actions/workflow/status/switon-php/invoker/ci.yml?branch=main&label=CI)](https://github.com/switon-php/invoker/actions/workflows/ci.yml) [![PHP 8.3+](https://img.shields.io/badge/PHP-8.3%2B-777BB4)](https://www.php.net/)
4+
5+
Switon's invoker layer that implements `Switon\Invoking\InvokerInterface` on top of `Switon\Di\InvokerInterface`, adding
6+
guard attributes and interceptors.
7+
8+
## Highlights
9+
10+
- **One invocation entrypoint:** callables, closures, and invokable objects all share the same path.
11+
- **Flexible argument matching:** position, name, type, and defaults can be combined.
12+
- **Guard support:** method guards can run before the target callable.
13+
- **Interceptor support:** pre, post, and exception handling can wrap the call.
14+
- **Built on DI:** the layer sits on top of the container invoker used by the framework.
15+
16+
## Installation
17+
18+
```bash
19+
composer require switon/invoker
20+
```
21+
22+
## Quick Start
23+
24+
```php
25+
use Switon\Core\Attribute\Autowired;
26+
use Switon\Invoking\InvokerInterface;
27+
28+
class RequestHandler
29+
{
30+
#[Autowired] protected InvokerInterface $invoker;
31+
32+
public function handle(object $controller, string $action, array $routeParams): mixed
33+
{
34+
return $this->invoker->invoke([$controller, $action], $routeParams);
35+
}
36+
}
37+
```
38+
39+
Docs: https://docs.switon.dev/latest/invoker
40+
41+
## License
42+
43+
MIT.

SECURITY.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Security fixes are provided for **currently supported release lines** of `switon/invoker` (`switon/invoker` on Packagist).
6+
7+
| Version line | Supported |
8+
|--------------|-----------|
9+
| `1.x` (latest stable release) | Yes |
10+
| Older major/minor lines with no maintained tag | No |
11+
12+
Check the latest release tag (for example `v1.0.1` on this repository) before reporting.
13+
14+
## Reporting a Vulnerability
15+
16+
**Please do not open a public GitHub issue for security vulnerabilities.**
17+
18+
Use one of these channels:
19+
20+
1. **GitHub private vulnerability reporting (preferred)**
21+
[Report a vulnerability](https://github.com/switon-php/invoker/security/advisories/new)
22+
23+
2. **Email**
24+
Send details to [[email protected]](mailto:[email protected]).
25+
26+
### What to Include
27+
28+
- Affected version (Composer constraint, tag, or commit)
29+
- Clear description of the issue and impact
30+
- Steps to reproduce, or a minimal proof of concept when possible
31+
- Any suggested fix or mitigation you have already identified
32+
33+
## What We Will Do
34+
35+
- Acknowledge receipt as soon as practicable (typically within a few business days)
36+
- Confirm whether the report affects supported versions
37+
- Work on a fix and coordinated disclosure
38+
- Publish a security advisory and patched release when appropriate
39+
- Credit reporters in the advisory when they wish to be named
40+
41+
## Out of Scope
42+
43+
The following are generally **not** treated as security vulnerabilities here:
44+
45+
- Reports against unsupported or unmaintained version lines
46+
- Issues that require misconfiguration or deployment choices outside documented guidance
47+
- Denial-of-service scenarios with no practical impact on confidentiality or integrity at default settings
48+
- Vulnerabilities in third-party dependencies already fixed in a newer supported release of that dependency (please report upstream; we will bump dependencies as part of maintenance)
49+
50+
For non-security bugs and feature requests, use the normal issue tracker on this repository.

composer.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "switon/invoker",
3+
"description": "Guard-aware and intercepted method invocation on top of the DI invoker for Switon Framework",
4+
"type": "library",
5+
"keywords": [
6+
"switon",
7+
"invoker",
8+
"dispatch",
9+
"reflection"
10+
],
11+
"homepage": "https://github.com/switon-php/invoker",
12+
"license": "MIT",
13+
"authors": [
14+
{
15+
"name": "switon",
16+
"email": "[email protected]"
17+
}
18+
],
19+
"support": {
20+
"source": "https://github.com/switon-php/invoker",
21+
"issues": "https://github.com/switon-php/invoker/issues",
22+
"docs": "https://docs.switon.dev/latest/invoker"
23+
},
24+
"require": {
25+
"php": ">=8.3",
26+
"switon/core": "^1.0",
27+
"switon/di": "^1.0",
28+
"switon/invocation": "^1.0"
29+
},
30+
"require-dev": {
31+
"phpstan/phpstan": "^2.0",
32+
"switon/binding": "^1.0",
33+
"switon/testing": "^1.0",
34+
"phpstan/extension-installer": "^1.4"
35+
},
36+
"config": {
37+
"allow-plugins": {
38+
"switon/composer-extra": true,
39+
"phpstan/extension-installer": true
40+
}
41+
},
42+
"autoload": {
43+
"psr-4": {
44+
"Switon\\Invoking\\": "src/"
45+
}
46+
},
47+
"autoload-dev": {
48+
"psr-4": {
49+
"Switon\\Invoking\\Tests\\": "tests/"
50+
}
51+
},
52+
"scripts": {
53+
"phpstan": "@php vendor/bin/phpstan analyse",
54+
"test:unit": "@php vendor/bin/phpunit --configuration tests/phpunit.xml.dist --testsuite=unit --display-deprecations --display-phpunit-notices",
55+
"test": "@php vendor/bin/phpunit --configuration tests/phpunit.xml.dist --testsuite=all --display-deprecations --display-phpunit-notices"
56+
},
57+
"extra": {
58+
"phpstan": {
59+
"includes": [
60+
"phpstan-extension.neon"
61+
]
62+
},
63+
"branch-alias": {
64+
"dev-dev": "1.0.x-dev"
65+
}
66+
}
67+
}

docs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../docs/en/invoker

phpstan-bootstrap.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$autoloadCandidates = [
6+
__DIR__ . '/vendor/autoload.php',
7+
dirname(__DIR__, 2) . '/vendor/autoload.php',
8+
];
9+
10+
foreach ($autoloadCandidates as $autoload) {
11+
if (is_file($autoload)) {
12+
require $autoload;
13+
return;
14+
}
15+
}
16+
17+
throw new RuntimeException('Unable to locate vendor/autoload.php for PHPStan bootstrap.');

phpstan-extension.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
-
3+
class: Switon\Invoking\PhpStan\InvokerInvokeMethodReturnTypeExtension
4+
tags:
5+
- phpstan.broker.dynamicMethodReturnTypeExtension

0 commit comments

Comments
 (0)