Skip to content

Commit 2f744cb

Browse files
committed
Add section about how to create your own middleware
1 parent 4249f7a commit 2f744cb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

source/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,21 @@ <h2>Example</h2>
7474
$response = $app->handle($request)->send();
7575
$app->terminate($request, $response);</code></pre>
7676
</div>
77+
78+
<hr>
79+
80+
<div class="middleware">
81+
<h2>Your own middleware</h2>
82+
<p>
83+
A stack middleware is just an object that follows these conventions:
84+
</p>
85+
<ul>
86+
<li>Implement the <code>HttpKernelInterface</code></li>
87+
<li>Take the decorated app as the first constructor argument</li>
88+
<li>Decorate the handle call, delegate to the decorated app</li>
89+
</ul>
90+
<p>
91+
Yes, leveraging the HTTP abstraction is that easy!
92+
</p>
93+
</div>
7794
{% endblock %}

0 commit comments

Comments
 (0)