1- ## Documentation
1+ # Documentation
22
33[ TOC]
44
5- ### Requirements
5+ ## Requirements
66
77Zack! requirements are:
88
@@ -20,7 +20,7 @@ Composer `--no-dev` requirements are:
2020- twig/markdown-extra: ^3.21
2121- twig/twig: ^3.20
2222
23- ### Installation
23+ ## Installation
2424
2525Create a new project folder and change into it.
2626
@@ -76,7 +76,7 @@ php -S localhost:8888 -t web
7676
7777Open < http://localhost:8888 > with your preferred web browser.
7878
79- ### Folder Structure
79+ ## Folder Structure
8080
8181A typical project folder structure looks like the following:
8282
@@ -98,7 +98,7 @@ project/ # Project root folder on your server
9898
9999Normally you only work in the ` routes ` and ` views ` folders.
100100
101- ### File-Based Routing
101+ ## File-Based Routing
102102
103103Zack! is using file-based routing for your routes.
104104Files are automatically mapped to Symfony routes.
@@ -130,7 +130,7 @@ routes/
130130└─ hello.post.php
131131~~~
132132
133- #### Simple Routes
133+ ### Simple Routes
134134
135135First, create a file in ` routes ` directory.
136136The filename will be the route path.
@@ -150,9 +150,9 @@ return new Response('{"ping": "pong"}', 200, [
150150]);
151151~~~
152152
153- #### Route With Params
153+ ### Route With Params
154154
155- ##### Single Param
155+ #### Single Param
156156
157157To define a route with params, use the ` [<param>] ` syntax where ` <param> ` is the name of the param.
158158The param will be available in the ` $request->attributes ` object.
@@ -177,7 +177,7 @@ Call the route with the param `/hello/zack`, you will get:
177177Hello zack!
178178~~~
179179
180- ##### Multiple Params
180+ #### Multiple Params
181181
182182You can define multiple params in a route using ` [<param1>]/[<param2>] ` syntax where each param is a folder.
183183You cannot define multiple params in a single filename of folder.
@@ -195,7 +195,7 @@ $age = $request->attributes->get('age');
195195return new Response("Hello $name! You are $age years old.", 200);
196196~~~
197197
198- ##### Catch All Params
198+ #### Catch All Params
199199
200200You can capture all the remaining parts of a URL using ` [...<param>] ` syntax. This will include the ` / ` in the param.
201201
@@ -219,7 +219,7 @@ Call the route with the param `/hello/zack/is/nice`, you will get:
219219Hello zack/is/nice!
220220~~~
221221
222- #### Specific Request Method
222+ ### Specific Request Method
223223
224224You can append the HTTP method to the filename to force the route to be matched only for a specific HTTP request method.
225225For example ` hello.get.php ` will only match for GET requests.
@@ -241,7 +241,7 @@ return new Response('{"updated": true}', 200, [
241241]);
242242~~~
243243
244- #### Catch All Route
244+ ### Catch All Route
245245
246246You can create a special route that will match all routes that are not matched by any other route.
247247This is useful for creating a default route.
@@ -260,7 +260,7 @@ $path = $request->attributes->get('path');
260260return new Response("Hello $path!", 200);
261261~~~
262262
263- ### Route Handler
263+ ## Route Handler
264264
265265You can use the file extension of a route file to force the route to be handled by a specific route handler.
266266
@@ -277,7 +277,7 @@ routes/
277277
278278Zack! is currently delivered with the following route handlers:
279279
280- #### HTML Route Handler
280+ ### HTML Route Handler
281281
282282File extensions: htm, html \
283283Response content-type: text/html; charset=UTF-8
@@ -287,7 +287,7 @@ The Twig layout is determined via the layout comment `<!-- layout: my-layout.htm
287287The page title is determined by the H1-H3 headings in the HTML content.
288288The layout is applied and output together with the page title and the HTML content.
289289
290- #### Markdown Route Handler
290+ ### Markdown Route Handler
291291
292292File extensions: markdown, md \
293293Response content-type: text/html; charset=UTF-8
@@ -303,14 +303,14 @@ The Twig layout is determined via the layout comment `<!-- layout: my-layout.htm
303303The page title is determined by the H1-H3 headings in the HTML content.
304304The layout is applied and output together with the page title and the HTML content.
305305
306- #### PHP Route Handler
306+ ### PHP Route Handler
307307
308308File extension: php \
309309Response content-type: text/html; charset=UTF-8, application/json; charset=UTF-8, or other
310310
311311The content-type of the response can be set explicitly in a PHP route handler.
312312
313- ##### Echoing Content
313+ #### Echoing Content
314314
315315The echoed content of the PHP file is taken.
316316
@@ -320,7 +320,7 @@ Otherwise the Twig layout is determined via the layout comment `<!-- layout: my-
320320The page title is determined by the H1-H3 headings in the HTML content.
321321The layout is applied and output together with the page title and the HTML content.
322322
323- ##### Returning Response
323+ #### Returning Response
324324
325325If you want finer control over the HTTP response, you can return a string, an array or a ` Symfony\Component\HttpFoundation\Response ` object.
326326
@@ -333,7 +333,7 @@ If the return value is a `Symfony\Component\HttpFoundation\Response` object, it
333333With returning a response object you will have full control over the HTTP response.
334334There are several response subclasses to help you return JSON, redirect, stream file downloads and more.
335335
336- #### Generic Route Handler
336+ ### Generic Route Handler
337337
338338The generic route handler is a handler that supports the following file types:
339339
@@ -345,21 +345,21 @@ The generic route handler is a handler that supports the following file types:
345345
346346The contents of the file are read and output together with the corresponding content type from the above mapping.
347347
348- ### Configuration
348+ ## Configuration
349349
350350TBD
351351
352- ### Events
352+ ## Events
353353
354- #### Zack! Events
354+ ### Zack! Events
355355
356356Zack! ships with the following events:
357357
358358- ** zack.container** : This event is dispatched after the container has been built.
359359- ** zack.controller** : This event is dispatched just before the controller (i.e. the route handler) is determined.
360360- ** zack.routes** : This event is dispatched after the routes have been built.
361361
362- #### HttpKernel Events
362+ ### HttpKernel Events
363363
364364Zack! supports the following Symfony HttpKernel events:
365365
@@ -373,9 +373,9 @@ Zack! supports the following Symfony HttpKernel events:
373373
374374Read [ Built-in Symfony Events] ( https://symfony.com/doc/current/reference/events.html#kernel-events ) for more information.
375375
376- ### Development Environment
376+ ## Development Environment
377377
378- #### Create Docker Image
378+ ### Create Docker Image
379379
380380Create Docker image based on the latest supported PHP version
381381
@@ -386,7 +386,7 @@ Optionally you can also use an older PHP version
386386 docker build --build-arg PHP_VERSION=8.2 -t zack https://github.com/tbreuss/zack.git
387387 docker build --build-arg PHP_VERSION=8.3 -t zack https://github.com/tbreuss/zack.git
388388
389- #### Run Website
389+ ### Run Website
390390
391391Clone project
392392
@@ -422,27 +422,27 @@ Open generated HTML report in browser
422422
423423 docker run --rm -p 8888:8888 -v .:/app zack php -S 0.0.0.0:8888 -t /app/.coverage/report
424424
425- ### Testing
425+ ## Testing
426426
427- #### Coding Style
427+ ### Coding Style
428428
429429Fix coding style issues using [ PHP-CS-Fixer] ( https://github.com/PHP-CS-Fixer/PHP-CS-Fixer )
430430
431431 ./bin/fix-coding-style.sh
432432
433- #### Static Code Analysis
433+ ### Static Code Analysis
434434
435435Analyse code using [ PHPStan] ( https://phpstan.org/ )
436436
437437 ./bin/analyse-code.sh
438438
439- #### Functional Tests
439+ ### Functional Tests
440440
441441Run functional tests using [ Hurl] ( https://hurl.dev/ )
442442
443443 ./bin/test-code.sh localhost:9330
444444
445- #### Website Tests
445+ ### Website Tests
446446
447447Run website tests using [ Hurl] ( https://hurl.dev/ )
448448
0 commit comments