Skip to content

Commit df0715e

Browse files
committed
Actualize docs
1 parent f851601 commit df0715e

File tree

9 files changed

+124
-46
lines changed

9 files changed

+124
-46
lines changed

Writerside/topics/application/application-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ $appConfig = new Boson\ApplicationCreateInfo(
4343

4444
<tip>
4545
Each registered scheme in this list will produce a
46-
<a href="webview-events.md#request-intention">WebViewRequest</a> intention
46+
<a href="schemes-api-events.md#request-intention">SchemeRequestReceived</a> intention
4747
when attempting to access a resource located at an address with this protocol.
4848
</tip>
4949

Writerside/topics/integrations/laravel-adapter.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1-
# Laravel HTTP Adapter
1+
# Laravel HTTP Bridge
22

3-
You can create a Laravel HTTP request in the same way as Symfony.
3+
The Laravel HTTP Bridge provides the ability to convert internal requests and
4+
responses of the [Schema API](schemes-api.md) to those compatible with the
5+
[Laravel Framework](https://laravel.com).
6+
7+
The bridge is supplied as a separate component and must be installed separately.
8+
9+
## Installation
10+
11+
<tldr>
12+
<p>
13+
Via <a href="https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies">Composer</a>:
14+
</p>
15+
<p>
16+
<code lang="bash">composer require boson-php/laravel-http-bridge</code>
17+
</p>
18+
</tldr>
19+
20+
**Requirements:**
21+
22+
* `PHP ^8.4`
23+
* `illuminate/http ^12.0`
24+
25+
## Usage
426

527
<warning>
628
Correct functionality is NOT GUARANTEED.
@@ -11,17 +33,17 @@ other "bad practice features".
1133
</warning>
1234

1335
To work with Laravel HTTP kernel you can use specific
14-
`Boson\Bridge\Http\LaravelHttpAdapter` adapter.
36+
`Boson\Bridge\Laravel\Http\LaravelHttpAdapter` adapter.
1537

1638
```php
1739
use Boson\Application;
1840
use Boson\ApplicationCreateInfo;
1941
use Boson\Bridge\Http\LaravelHttpAdapter;
20-
use Boson\WebView\Event\WebViewRequest;
42+
use Boson\WebView\Api\Schemes\Event\SchemeRequestReceived;
2143

2244
// Create an application
2345
$app = new Application(new ApplicationCreateInfo(
24-
schemes: ['laravel'],
46+
schemes: [ 'laravel' ],
2547
));
2648

2749
// Do not forget to fix for known Laravel issue with using
@@ -32,7 +54,7 @@ $app = new Application(new ApplicationCreateInfo(
3254
$laravel = new LaravelHttpAdapter();
3355

3456
// Subscribe to receive a request
35-
$app->on(function (WebViewRequest $e) use ($laravel): void {
57+
$app->on(function (SchemeRequestReceived $e) use ($laravel): void {
3658
$laravelRequest = $laravel->createRequest($e->request);
3759

3860
// ...do something, like:

Writerside/topics/integrations/psr7-adapter.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,43 @@
1-
# PSR-7 HTTP Adapter
1+
# PSR HTTP Adapter
22

3-
To work with any PSR-7/17-compatible framework
4-
(e.g. [Yii3](https://github.com/yiisoft/demo),
5-
[Spiral](https://spiral.dev/), [Slim](https://www.slimframework.com/), etc.),
6-
you are provided with a corresponding adapter `Boson\Bridge\Http\Psr7HttpAdapter`.
3+
The PSR HTTP Bridge provides the ability to convert internal requests and
4+
responses of the [Schema API](schemes-api.md) to those compatible with
5+
any PSR-7 compatible frameworks (e.g. [Yii3](https://github.com/yiisoft/demo),
6+
[Spiral](https://spiral.dev/), [Slim](https://www.slimframework.com/), etc.).
7+
8+
The bridge is supplied as a separate component and must be installed separately.
9+
10+
## Installation
11+
12+
<tldr>
13+
<p>
14+
Via <a href="https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies">Composer</a>:
15+
</p>
16+
<p>
17+
<code lang="bash">composer require boson-php/psr-http-bridge</code>
18+
</p>
19+
</tldr>
20+
21+
**Requirements:**
22+
23+
* `PHP ^8.4`
24+
* `psr/http-message ^1.0|^2.0`
25+
* `psr/http-factory ^1.0`
26+
27+
## Usage
28+
29+
To work with any PSR-7/17-compatible framework, you are provided with a
30+
corresponding adapter `Boson\Bridge\Psr\Http\Psr7HttpAdapter`.
731

832
```php
933
use Boson\Application;
1034
use Boson\ApplicationCreateInfo;
1135
use Boson\Bridge\Http\Psr7HttpAdapter;
12-
use Boson\WebView\Event\WebViewRequest;
36+
use Boson\WebView\Api\Schemes\Event\SchemeRequestReceived;
1337

1438
// Create an application
1539
$app = new Application(new ApplicationCreateInfo(
16-
schemes: ['psr7'],
40+
schemes: [ 'psr7' ],
1741
));
1842

1943
// Create PSR-7 HTTP adapter
@@ -22,7 +46,7 @@ $psr7 = new Psr7HttpAdapter(
2246
);
2347

2448
// Subscribe to receive a request
25-
$app->on(function (WebViewRequest $e) use ($psr7): void {
49+
$app->on(function (SchemeRequestReceived $e) use ($psr7): void {
2650
$psr7Request = $psr7->createRequest($e->request);
2751

2852
// ...do something, like:

Writerside/topics/integrations/static-files.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
11
# Static Files
22

3+
Static provider exist to serve files without execution of application code.
4+
5+
The provider is supplied as a separate component and must be installed separately.
6+
7+
## Installation
8+
9+
<tldr>
10+
<p>
11+
Via <a href="https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies">Composer</a>:
12+
</p>
13+
<p>
14+
<code lang="bash">composer require boson-php/http-static-provider</code>
15+
</p>
16+
</tldr>
17+
18+
**Requirements:**
19+
20+
* `PHP ^8.4`
21+
* `psr/http-message ^1.0|^2.0`
22+
* `psr/http-factory ^1.0`
23+
24+
## Usage
25+
326
Static adapters exist to serve files without execution of application code.
427

528
## Filesystem
629

730
To return static files from the filesystem, you can use specific
8-
`Boson\Bridge\Static\FilesystemStaticAdapter` static adapter.
31+
`Boson\Component\Http\Static\FilesystemStaticAdapter` static adapter.
932

1033
```php
1134
use Boson\Application;
1235
use Boson\ApplicationCreateInfo;
1336
use Boson\Bridge\Static\FilesystemStaticAdapter;
14-
use Boson\WebView\Event\WebViewRequest;
37+
use Boson\WebView\Api\Schemes\Event\SchemeRequestReceived;
1538

1639
// Create an application
1740
$app = new Application(new ApplicationCreateInfo(
@@ -21,7 +44,7 @@ $app = new Application(new ApplicationCreateInfo(
2144
// Create static files adapter
2245
$static = new FilesystemStaticAdapter([__DIR__ . '/public']);
2346

24-
$app->on(function (WebViewRequest $e) use ($static): void {
47+
$app->on(function (SchemeRequestReceived $e) use ($static): void {
2548
// Lookup static file and create response in
2649
// case of given file is available.
2750
$e->response = $static->lookup($e->request);

Writerside/topics/integrations/symfony-adapter.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,48 @@
11
# Symfony HTTP Adapter
22

3+
The Symfony HTTP Bridge provides the ability to convert internal requests and
4+
responses of the [Schema API](schemes-api.md) to those compatible with the
5+
[Symfony Framework](https://symfony.com).
6+
7+
The bridge is supplied as a separate component and must be installed separately.
8+
9+
## Installation
10+
11+
<tldr>
12+
<p>
13+
Via <a href="https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies">Composer</a>:
14+
</p>
15+
<p>
16+
<code lang="bash">composer require boson-php/symfony-http-bridge</code>
17+
</p>
18+
</tldr>
19+
20+
**Requirements:**
21+
22+
* `PHP ^8.4`
23+
* `symfony/http-foundation ^6.4|^7.0`
24+
25+
## Usage
26+
327
To work with Symfony HTTP kernel you can use specific
4-
`Boson\Bridge\Http\SymfonyHttpAdapter` adapter.
28+
`Boson\Bridge\Symfony\Http\SymfonyHttpAdapter` adapter.
529

630
```php
731
use Boson\Application;
832
use Boson\ApplicationCreateInfo;
933
use Boson\Bridge\Http\SymfonyHttpAdapter;
10-
use Boson\WebView\Event\WebViewRequest;
34+
use Boson\WebView\Api\Schemes\Event\SchemeRequestReceived;
1135

1236
// Create an application
1337
$app = new Application(new ApplicationCreateInfo(
14-
schemes: ['symfony'],
38+
schemes: [ 'symfony' ],
1539
));
1640

1741
// Create Symfony HTTP adapter
1842
$symfony = new SymfonyHttpAdapter();
1943

2044
// Subscribe to receive a request
21-
$app->on(function (WebViewRequest $e) use ($symfony): void {
45+
$app->on(function (SchemeRequestReceived $e) use ($symfony): void {
2246
$symfonyRequest = $symfony->createRequest($e->request);
2347

2448
// ...do something, like:

Writerside/topics/webview/data-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ If the page is currently loading, synchronous requests are also unavailable.
6363
<code-block lang="php">
6464
$app = new Boson\Application();
6565

66-
$app->on(function(Boson\WebView\Event\WebViewNavigating $e) {
66+
$app->on(function (Boson\WebView\Event\WebViewNavigating $e): void {
6767
var_dump($e->subject->data->get('document.location'));
6868
//
6969
// Boson\WebView\Api\Data\Exception\WebViewIsNotReadyException:

Writerside/topics/webview/schemes-api.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ them in the list of schemes.
1616

1717
```php
1818
$app = new Boson\Application(new Boson\ApplicationCreateInfo(
19-
// List of handling "https" protocol
2019
schemes: [ 'test' ],
2120
));
2221

@@ -49,14 +48,14 @@ case, `test`), you can start catching the corresponding events of sending
4948
requests to this protocol (to this scheme).
5049

5150
```php
52-
use Boson\WebView\Event\WebViewRequest;
51+
use Boson\WebView\Api\Schemes\Event\SchemeRequestReceived;
5352

5453
$app = new Boson\Application(new Boson\ApplicationCreateInfo(
55-
// List of middleware for "https" protocol
54+
// List of intecpted schemes
5655
schemes: [ 'test' ],
5756
));
5857

59-
$app->on(function (WebViewRequest $e): void {
58+
$app->on(function (SchemeRequestReceived $e): void {
6059
echo sprintf("%s %s\r\n", $e->request->method, $e->request->url);
6160

6261
foreach ($e->request->headers as $header => $value) {
@@ -85,7 +84,7 @@ In that case, if you need to block a request to a specified URL,
8584
you can cancel it.
8685

8786
```php
88-
$app->on(function (WebViewRequest $e): void {
87+
$app->on(function (SchemeRequestReceived $e): void {
8988
$e->cancel();
9089
});
9190
```
@@ -94,7 +93,7 @@ In addition to canceling a request, you can also simulate a
9493
response from a resource.
9594

9695
```php
97-
$app->on(function (WebViewRequest $e): void {
96+
$app->on(function (SchemeRequestReceived $e): void {
9897
$e->response = new Boson\Http\Response(
9998
body: 'Hello World!',
10099
);
@@ -104,7 +103,7 @@ $app->on(function (WebViewRequest $e): void {
104103
Or a more complex response example:
105104

106105
```php
107-
$app->on(function (WebViewRequest $e): void {
106+
$app->on(function (SchemeRequestReceived $e): void {
108107
$e->response = new Boson\Http\Response(
109108
body: json_encode(['error' => 'Something went wrong']),
110109
headers: ['content-type' => 'application/json'],
@@ -116,7 +115,7 @@ $app->on(function (WebViewRequest $e): void {
116115
Or using specific `JsonResponse` response instance:
117116

118117
```php
119-
$app->on(function (WebViewRequest $e): void {
118+
$app->on(function (SchemeRequestReceived $e): void {
120119
$e->response = new Boson\Http\JsonResponse(
121120
body: ['error' => 'Something went wrong'],
122121
status: 404,

Writerside/topics/webview/schemes-api/schemes-api-events.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ registered [in the configuration](application-configuration.md#intercepted-schem
2222
class SchemeRequestReceived<WebView>
2323
{
2424
public readonly Boson\Http\RequestInterface $request;
25+
2526
public ?Boson\Http\ResponseInterface $response = null;
2627
}
2728
```

Writerside/topics/webview/webview-events.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,6 @@ class WebViewNavigated<WebView>
155155

156156
- `$url` - The URL address by which navigation occurs.
157157

158-
## Request Intention
159-
<secondary-label ref="intention"/>
160-
161-
An `Boson\WebView\Event\WebViewRequest` intention processing of user schemes
162-
registered [in the configuration](application-configuration.md#intercepted-schemes).
163-
164-
<warning>
165-
Since version <code>0.11.0</code> this is an alias for
166-
<code>Boson\WebView\Api\Schemes\Event\SchemeRequestReceived</code> intention.
167-
</warning>
168-
169-
<tip>
170-
See more information [in Scheme API Events](schemes-api-events.md).
171-
</tip>
172-
173158
## Title Changing Intention
174159
<secondary-label ref="intention"/>
175160

0 commit comments

Comments
 (0)