Skip to content

Commit 34e4556

Browse files
committed
Rework the front page to explain the motivation and list the currently supported frameworks
1 parent a502dc1 commit 34e4556

File tree

1 file changed

+55
-19
lines changed

1 file changed

+55
-19
lines changed

source/index.html

Lines changed: 55 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,63 @@ <h1>Stack</h1>
2020

2121
<hr>
2222

23+
<div class="why">
24+
<h2>Why?</h2>
25+
<p>
26+
Right now there is no easy way to re-use HTTP-specific code in PHP. Accessing superglobals and emitting headers and data as side effects is messy and unpredictable. While frameworks are becoming more decoupled, they still have their own implementation of anything that touches HTTP.
27+
</p>
28+
<p>
29+
We want to fix this.
30+
</p>
31+
<p>
32+
What worked for the Ruby world with <a href="http://rack.github.io/">Rack</a> (similar interfaces exist for Java, Python, Perl and others) can work for PHP with Stack.
33+
</p>
34+
</div>
35+
36+
<hr>
37+
2338
<div class="about">
2439
<h2>What is Stack?</h2>
2540
<p>
26-
Stack is a convention for composing <a href="https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpKernelInterface.php">HttpKernelInterface</a> middlewares. It evolved from a blog post titled <a href="https://igor.io/2013/02/02/http-kernel-middlewares.html">HttpKernel middlewares</a> in which it was proposed that <code>HttpKernelInterface</code> decorators could be created to mimic functionality similar to that of <a href="http://rack.github.io/">Rack</a> or other language-specific HTTP interfaces.
41+
Stack is a convention for composing <a href="https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpKernelInterface.php">HttpKernelInterface</a> middlewares. Any framework based on Symfony2's HttpKernelInterface can use these middlewares. They allow an application to be extended in a generic way, simply by wrapping objects around the kernel.
42+
</p>
43+
</div>
44+
45+
<hr>
46+
47+
<div class="frameworks">
48+
<h2>Which frameworks support Stack?</h2>
49+
<p>
50+
The following frameworks and apps are using the HttpKernelInterface abstraction and can thus benefit from Stack:
51+
</p>
52+
<ul>
53+
<li><a href="http://symfony.com/">Symfony2</a></li>
54+
<li><a href="http://silex.sensiolabs.org/">Silex</a></li>
55+
<li><a href="http://laravel.com/">Laravel4</a></li>
56+
<li><a href="https://drupal.org/">Drupal8</a></li>
57+
<li><a href="http://ez.no/">eZ Publish 5</a></li>
58+
<li><a href="http://yolophp.com/">YOLO</a></li>
59+
<li>Your own?</li>
60+
</ul>
61+
<p>
62+
As more frameworks and apps join in, more re-use will be possible.
63+
</p>
64+
</div>
65+
66+
<hr>
67+
68+
<div class="middleware">
69+
<h2>Conventions</h2>
70+
<p>
71+
A stack middleware is just an object that follows these conventions:
72+
</p>
73+
<ul>
74+
<li>Implement the <code>HttpKernelInterface</code></li>
75+
<li>Take the decorated app as the first constructor argument</li>
76+
<li>Decorate the handle call, delegate to the decorated app</li>
77+
</ul>
78+
<p>
79+
Yes, leveraging the HTTP abstraction is that easy!
2780
</p>
2881
</div>
2982

@@ -60,7 +113,7 @@ <h3>OAuth <i class="icon-lock pull-right"></i></h3>
60113
<hr>
61114

62115
<div class="examples">
63-
<h2>Example</h2>
116+
<h2>How do I use it?</h2>
64117
<pre><code class="php">use Symfony\Component\HttpFoundation\Request;
65118
use Symfony\Component\HttpKernel\HttpCache\Store;
66119

@@ -82,23 +135,6 @@ <h2>Example</h2>
82135
$app->terminate($request, $response);</code></pre>
83136
</div>
84137

85-
<hr>
86-
87-
<div class="middleware">
88-
<h2>Your own middleware</h2>
89-
<p>
90-
A stack middleware is just an object that follows these conventions:
91-
</p>
92-
<ul>
93-
<li>Implement the <code>HttpKernelInterface</code></li>
94-
<li>Take the decorated app as the first constructor argument</li>
95-
<li>Decorate the handle call, delegate to the decorated app</li>
96-
</ul>
97-
<p>
98-
Yes, leveraging the HTTP abstraction is that easy!
99-
</p>
100-
</div>
101-
102138
<footer class="authors container">
103139
<p class="lead">Brought to you by</p>
104140
<ul class="avatars">

0 commit comments

Comments
 (0)