Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
214 lines (192 loc) · 8.5 KB
/
Copy pathindex.html
File metadata and controls
214 lines (192 loc) · 8.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
---
layout: default
---
{% block full_title %}{{ site.title }} — {{ site.subtitle }}{% endblock %}
{% block content %}
<div class="jumbotron masthead">
<h1>Stack</h1>
<p class="tagline">Composing <a href="https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpKernelInterface.php">HttpKernelInterface</a> middlewares since 2013!</p>
<p>
<ul class="nav nav-pills" style="display: inline-block;">
<li>
<a href="https://github.com/stackphp"><i class="icon-github"></i> stackphp</a>
</li>
<li>
<a href="https://twitter.com/stackphp"><i class="icon-twitter"></i> @stackphp</a>
</li>
<li>
<a href="irc://irc.freenode.net/%23stackphp"><i class="icon-comment"></i> #stackphp</a>
</li>
</ul>
</p>
</div>
<hr>
<div class="about text">
<h2>A common layer</h2>
<p>
What do we want? Re-use at the web layer!
</p>
<p>
Superglobals and side-effecting output mechanisms of PHP make this challenging and force every framework to re-invent.
</p>
<p>
But Symfony's HttpKernelInterface provides a solid abstraction, which makes creating and sharing framework-agnostic HTTP filters a breeze!
</p>
</div>
<hr>
<div class="about text">
<h2>HttpKernel</h2>
<p>
The <a href="https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpKernelInterface.php">HttpKernelInterface</a> models web request and response as PHP objects, giving them value semantics.
</p>
<figure>
<img src="{{ site.url }}/img/kernel.png" alt="HttpKernel">
</figure>
</div>
<hr>
<div class="about text">
<h2>What is Stack?</h2>
<p>
Stack is a convention for composing HttpKernelInterface middlewares.
</p>
<figure>
<img src="{{ site.url }}/img/onion.png" alt="Kernel Onion">
</figure>
<p>
By wrapping your application in decorators you can add new behaviour from the outside.
</p>
</div>
<hr>
<div class="frameworks">
<h2 class="text-center">Supported frameworks</h2>
{% spaceless %}
<ul class="frameworks-logo-list clearfix">
<li><a href="http://symfony.com/"><img src="{{site.url}}/img/users/symfony.png" alt="Symfony 2" /></a></li>
<li><a href="http://silex.sensiolabs.org/"><img src="{{site.url}}/img/users/silex.png" alt="Silex" /></a></li>
<li><a href="http://laravel.com/"><img src="{{site.url}}/img/users/laravel.png" alt="Laravel 4" /></a></li>
<li><a href="https://drupal.org/"><img src="{{site.url}}/img/users/drupal.png" alt="Drupal8" /></a></li>
<li><a href="http://ez.no/"><img src="{{site.url}}/img/users/ez-publish.png" alt="eZ Publish 5" /></a></li>
<li><a href="http://yolophp.com/"><img src="{{site.url}}/img/users/yolo.png" alt="Yolo" /></a></li>
</ul>
{% endspaceless %}
</div>
<hr>
<div class="middleware text">
<h2>Conventions</h2>
<p>
A stack middleware is just an object that follows these <strong>conventions</strong>:
</p>
<ol class="conventions inline clearfix">
<li class="span4 clearfix"><div class="no">1</div> Implement the <strong>HttpKernelInterface</strong></li>
<li class="span4 clearfix"><div class="no">2</div> Take the <strong>decorated app</strong> as the first constructor argument</li>
<li class="span4 clearfix"><div class="no">3</div> Decorate the handle call, <strong>delegate</strong> to the decorated app</li>
</ol>
<p>
Yes, leveraging the HTTP abstraction is that easy!
</p>
</div>
<hr>
<div class="toolbox">
<h2>The Toolbox</h2>
<div class="row-fluid">
<div class="tool well well-small span6">
<h3>Builder <i class="icon-wrench pull-right"></i></h3>
<p>Builder constructs a nested <code>HttpKernelInterface</code> decorator tree. It models it as a stack of middlewares.</p>
<p><a class="btn" href="https://github.com/stackphp/builder">Learn More</a></p>
</div>
<div class="tool well well-small span6">
<h3>Session <i class="icon-eye-open pull-right"></i></h3>
<p>Provides a request session for subsequent middlewares. Based on the <a href="http://silex.sensiolabs.org/">Silex</a> <a href="http://silex.sensiolabs.org/doc/providers/session.html">SessionServiceProvider</a>.</p>
<p><a class="btn" href="https://github.com/stackphp/session">Learn More</a></p>
</div>
</div>
<div class="row-fluid">
<div class="tool well well-small span6">
<h3>URL Map <i class="icon-map-marker pull-right"></i></h3>
<p>Provides the ability to map paths to specific <code>HttpKernelInterface</code> applications and dispatches accordingly.</p>
<p><a class="btn" href="https://github.com/stackphp/url-map">Learn More</a></p>
</div>
<div class="tool well well-small span6">
<h3>OAuth <i class="icon-lock pull-right"></i></h3>
<p>Provides experimental OAuth authentication for subsequent middlewares. Leverages <a href="https://github.com/Lusitanian/PHPoAuthLib">PHPoAuthLib</a>.</p>
<p><a class="btn" href="https://github.com/stackphp/oauth">Learn More</a></p>
</div>
</div>
</div>
<hr>
<div class="middlewares">
<h2>Community Middlewares</h2>
<div class="row-fluid">
<div class="span6">
<h3>HttpCache</h3>
<p>The Symfony2 cache system relies on the simplicity and power of the HTTP cache as defined in the <a href="http://symfony.com/doc/current/glossary.html#term-http-specification">HTTP specification</a>.</p>
<div class="btn-group">
<a class="btn" href="https://github.com/symfony/symfony/tree/master/src/Symfony/Component/HttpKernel"><i class="icon icon-github"></i> GitHub</a>
<a class="btn" href="http://symfony.com/doc/current/book/http_cache.html"><i class="icon icon-book"></i> Docs</a>
<a class="btn" href="https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php"><i class="icon icon-code"></i> Code</a>
</div>
</div>
<div class="span6">
<h3>GeoIp</h3>
<p>Adds geolocation results to the request for subsequent middlewares. Can use any geocoding provider from <a href="http://geocoder-php.org">http://geocoder-php.org</a>.</p>
<div class="btn-group">
<a class="btn" href="https://github.com/herebeducks/StackGeoIp"><i class="icon icon-github"></i> GitHub</a>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<h3>IpRestrict</h3>
<p>Stack middleware for restricting application access to specific IP addresses.</p>
<div class="btn-group">
<a class="btn" href="https://github.com/alsar/stack-ip-restrict"><i class="icon icon-github"></i> GitHub</a>
</div>
</div>
</div>
</div>
<!--
<hr>
<div class="examples">
<h2>How do I use it?</h2>
<pre><code class="php">use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpCache\Store;
// This can be **any** HttpKernelInterface based application
$app = new Silex\Application();
$app->get('/', function () {
return 'Hello World!';
});
// Extend the behaviour of the application with some middlewares
$stack = (new Stack\Builder())
->push('Stack\Session')
->push('Symfony\Component\HttpKernel\HttpCache\HttpCache', new Store(__DIR__.'/cache'));
$app = $stack->resolve($app);
// Front controller is business as usual
$request = Request::createFromGlobals();
$response = $app->handle($request)->send();
$app->terminate($request, $response);</code></pre>
</div>
-->
<footer class="authors container">
<p class="lead">Brought to you by</p>
<ul class="avatars">
<li>
<a href="https://twitter.com/igorwesome">
<img class="img-circle" src="{{ site.url }}/img/igorwesome.jpeg">
@igorwesome
</a>
</li>
<li>
<a href="https://twitter.com/beausimensen">
<img class="img-circle" src="{{ site.url }}/img/beausimensen.png">
@beausimensen
</a>
</li>
<li>
<a href="https://twitter.com/hochchristoph">
<img class="img-circle" src="{{ site.url }}/img/hochchristoph.jpg">
@hochchristoph
</a>
</li>
</ul>
</footer>
{% endblock %}