Skip to content

Commit 76c2cc6

Browse files
committed
Experimental; Implicity Controllers; Resource
1 parent b88e2fb commit 76c2cc6

File tree

6 files changed

+187
-17
lines changed

6 files changed

+187
-17
lines changed

en/docs/configurations.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h2 id="composer-autoload">
1919
<a href="#autoload">Autoload</a>
2020
</h2>
2121

22-
<p>inphinit-autoloaderer is an optimized loader that allows you to load classes installed via composer. To use composerautoloader, change the value <code>INPHINIT_COMPOSER</code> to <code>true</code> in <code>index.php</code>, for example:</p>
22+
<p><em>Inphinit Autoloader</em> is an optimized loader that allows you to load classes installed via composer. To use <em>Composer Autoloader</em>, change the value <code>INPHINIT_COMPOSER</code> to <code>true</code> in <code>index.php</code>, for example:</p>
2323

2424
<div class="box">
2525
<code tabindex="0"><em>define</em>(<b>'INPHINIT_COMPOSER'</b>, <i>true</i>);</code>
@@ -46,7 +46,7 @@ <h2 id="constants">
4646
<td>
4747
✔️ <div class="sr">is editable</div>
4848
</td>
49-
<td>In the <code>index.php</code> file, set this constant to <code>true</code> if you want to use composer-autoload, otherwise it will use inphinit-autoloader.</td>
49+
<td>In the <code>index.php</code> file, set this constant to <code>true</code> if you want to use <em>Composer Autoloader</em>, otherwise it will use <em>Inphinit Autoloader</em>.</td>
5050
</tr>
5151
<tr>
5252
<td><code>INPHINIT_ROOT</code></td>

en/docs/experimental.html

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,36 @@
1212
<div id="container">
1313
<main>
1414
<h1>Experimental</h1>
15-
<p>Learn how to create a new Inphinit project.</p>
15+
<p>Provides experimental features for you to explore and even give feedback on whether they are interesting features for future releases.</p>
16+
17+
<section>
18+
<h2 id="documentation">
19+
<a href="#documentation">Documentation</a>
20+
</h2>
21+
22+
<p>
23+
Not all experimental features will be documented, but you can refer to <a href="/api/2.1/Experimental.html" rel="help">API specification</a> for technical instructions on how to use them. It is important to note that all experimental features will be in the <code>Inphinit\Experimental</code> namespace.
24+
</p>
25+
26+
<p>
27+
It is important to understand that experimental features may be removed in the future, so avoid relying on them entirely. The goal is to experiment with new features and get feedback from the community.
28+
</p>
29+
30+
<p>
31+
The feature may be removed without warning in future releases, but it may also be moved to the main namespace, in which case the feature will be maintained for some time in both namespaces, to avoid breaking applications that still use the <code>Inphinit\Experimental</code> namespace.
32+
</p>
33+
</section>
34+
35+
<section>
36+
<h2 id="try-it">
37+
<a href="#try-it">Try it</a>
38+
</h2>
39+
40+
<ul>
41+
<!-- <li><a href="/api/2.1/Experimental/Forwarded.html" rel="help">Inphinit\Experimental\Forwarded</a></li> -->
42+
<li><a href="/api/2.1/Experimental/Method.html" rel="help">Inphinit\Experimental\Method</a></li>
43+
</ul>
44+
</section>
1645

1746
<footer>
1847
<div></div>

en/docs/http/request.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@ <h2 id="determine-types-of-requests">
3131
<tr>
3232
<td><code>Request::is('pjax')</code></td>
3333
<td>
34-
Returns <code>true</code> if send <code>X-Pjax</code> header in request, otherwise returns <code>false</code>
34+
Returns <code>true</code> if sent <code>X-Pjax</code> header in request, otherwise returns <code>false</code>.
3535
</td>
3636
</tr>
3737
<tr>
3838
<td><code>Request::is('prefetch')</code></td>
3939
<td>
40-
Returns <code>true</code> if send <i>prefetch</i> header (eg.: <code>sec-purpose</code>, <code>x-purpose</code>, <code>purpose</code>, <code>x-moz</code>) in request, otherwise returns <code>false</code>
40+
Returns <code>true</code> if sent <i>prefetch</i> header (eg.: <code>sec-purpose</code>, <code>x-purpose</code>, <code>purpose</code>, <code>x-moz</code>) in request, otherwise returns <code>false</code>.
4141
</td>
4242
</tr>
4343
<tr>
4444
<td><code>Request::is('save')</code></td>
4545
<td>
46-
Returns <code>true</code> if send <code>Save-Data: on</code> header in request, otherwise returns <code>false</code>
46+
Returns <code>true</code> if sent <code>Save-Data: on</code> header in request, otherwise returns <code>false</code>.
4747
</td>
4848
</tr>
4949
<tr>
5050
<td><code>Request::is('secure')</code></td>
5151
<td>
52-
Returns <code>true</code> if using HTTPS, otherwise returns <code>false</code>
52+
Returns <code>true</code> if using HTTPS, otherwise returns <code>false</code>.
5353
</td>
5454
</tr>
5555
<tr>
5656
<td><code>Request::is('xhr')</code></td>
5757
<td>
58-
Returns <code>true</code> if send <code>X-Requested-With: XMLHttpRequest</code> header in request, otherwise returns <code>false</code>
58+
Returns <code>true</code> if sent <code>X-Requested-With: XMLHttpRequest</code> header in request, otherwise returns <code>false</code>.
5959
</td>
6060
</tr>
6161
</tbody>

en/docs/http/response.html

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,21 @@ <h2 id="create-routes">
4545
<a href="#Create-routes">Set cache or no-cache headers</a>
4646
</h2>
4747

48-
<p>Set HTTP cache or set no-cache</p>
48+
<p>Cache expires 1 week</p>
49+
50+
<div class="box">
51+
<code><i>use</i> Inphinit\Http\<em>Response</em>;
52+
53+
<em>Response</em>::cache(<em>strtotime</em>(<b>'+1 week'</b>));</code>
54+
</div>
55+
56+
<p>No-cache</p>
57+
58+
<div class="box">
59+
<code><i>use</i> Inphinit\Http\<em>Response</em>;
60+
61+
<em>Response</em>::cache(-1);</code>
62+
</div>
4963
</section>
5064

5165
<section>
@@ -54,6 +68,20 @@ <h2 id="create-routes">
5468
</h2>
5569

5670
<p>{placeholder}</p>
71+
72+
<div class="box">
73+
<code><i>use</i> Inphinit\Http\<em>Response</em>;
74+
75+
<em>Response</em>::download(<b>'page.html'</b>);</code>
76+
</div>
77+
78+
<p>{placeholder}</p>
79+
80+
<div class="box">
81+
<code><i>use</i> Inphinit\Http\<em>Response</em>;
82+
83+
<em>Response</em>::download(<b>'report.pdf'</b>);</code>
84+
</div>
5785
</section>
5886

5987
<footer>

en/docs/routing/implicit-route-controllers.html

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,59 @@ <h1>Implicit route controllers</h1>
1515
<p>Learn how to create a new Inphinit project.</p>
1616

1717
<section>
18-
<h2 id="create-routes">
19-
<a href="#Create-routes">Create routes</a>
18+
<h2 id="create-controller">
19+
<a href="#create-controller">Create controller</a>
2020
</h2>
21+
22+
<div class="box">
23+
<code>&lt;?php
24+
namespace Controller;
25+
26+
class ImplicitController extends \Inphinit\Routing\Treaty
27+
{
28+
public function getIndex()
29+
{
30+
return 'Home';
31+
}
32+
33+
public function getInfo()
34+
{
35+
phpinfo();
36+
}
37+
38+
public function postPing()
39+
{
40+
error_log($_SERVER['REMOTE_ADDR']);
41+
}
42+
43+
public function anyFooBarBaz()
44+
{
45+
phpinfo();
46+
}
47+
}</code>
48+
</div>
2149
</section>
2250

23-
<!-- placeholder -->
51+
<section>
52+
<h2 id="create-controller">
53+
<a href="#create-controller">Create controller</a>
54+
</h2>
55+
56+
<p>{placeholder}</p>
57+
58+
<div class="box">
59+
<code>\Controller\ImplicitController::action($app);</code>
60+
</div>
61+
62+
<p>Is equivant to</p>
63+
64+
<div class="box">
65+
<code>$app-&gt;action('GET', '/', 'ImplicitController::getIndex');
66+
$app-&gt;action('GET', '/info', 'ImplicitController::getInfo');
67+
$app-&gt;action('POST', '/ping', 'ImplicitController::postPing');
68+
$app-&gt;action('ANY', '/foo-bar-baz', 'ImplicitController::anyFooBarBaz');</code>
69+
</div>
70+
</section>
2471
</main>
2572
<footer>
2673
<div>

en/docs/routing/resource.html

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,78 @@ <h1>Resource routes</h1>
1515
<p>Resource is an optional resource to make route creation easier, like CRUD.</p>
1616

1717
<section>
18-
<h2 id="Resource">
19-
<a href="#Resource">Resource</a>
18+
<h2 id="create-controller">
19+
<a href="#create-controller">Create controller</a>
2020
</h2>
21+
22+
<div class="box">
23+
<code>&lt;?php
24+
namespace Controller;
25+
26+
class ResourceSample extends \Inphinit\Routing\Resource
27+
{
28+
public function index()
29+
{
30+
return 'index';
31+
}
32+
33+
public function create()
34+
{
35+
return 'create';
36+
}
37+
38+
public function store()
39+
{
40+
return 'store';
41+
}
42+
43+
public function show()
44+
{
45+
return 'show';
46+
}
47+
48+
public function edit()
49+
{
50+
return 'edit';
51+
}
52+
53+
public function update()
54+
{
55+
return 'update';
56+
}
57+
58+
public function destroy()
59+
{
60+
return 'destroy';
61+
}
62+
}
63+
</code>
64+
</div>
2165
</section>
2266

23-
<!-- placeholder -->
67+
<section>
68+
<h2 id="create-controller">
69+
<a href="#create-controller">Create controller</a>
70+
</h2>
71+
72+
<p>{placeholder}</p>
73+
74+
<div class="box">
75+
<code>\Controller\ResourceSample::action($app);</code>
76+
</div>
77+
78+
<p>Is equivant to</p>
79+
80+
<div class="box">
81+
<code>$app-&gt;action('GET', '/', 'ResourceSample:index');
82+
$app-&gt;action('GET', '/create', 'ResourceSample:create');
83+
$app-&gt;action('POST', '/', 'ResourceSample:store');
84+
$app-&gt;action('GET', '/{:[^/]+:}/edit', 'ResourceSample:edit');
85+
$app-&gt;action('GET', '/{:[^/]+:}', 'ResourceSample:show');
86+
$app-&gt;action('PUT', '/{:[^/]+:}', 'ResourceSample:update');
87+
$app-&gt;action('DELETE', '/{:[^/]+:}', 'ResourceSample:destroy');</code>
88+
</div>
89+
</section>
2490
</main>
2591
<footer>
2692
<div>
@@ -103,8 +169,8 @@ <h2 id="Resource">
103169
<a href="/en/docs/routing/">Routing</a>
104170
<dl>
105171
<dt>Routing features</dt>
106-
<dd><a href="/en/docs/routing/implicit-route-controllers.html">Implicit route controllers</a></dd>
107-
<dd><a href="/en/docs/routing/resource.html" class="current">Resource routes</a></dd>
172+
<dd><a href="/en/docs/routing/implicit-route-controllers.html" class="current">Implicit route controllers</a></dd>
173+
<dd><a href="/en/docs/routing/resource.html">Resource routes</a></dd>
108174
</dl>
109175
<a href="/en/docs/controllers.html">Controllers</a>
110176
<a href="/en/docs/views.html">Views</a>

0 commit comments

Comments
 (0)