Skip to content
This repository was archived by the owner on May 11, 2019. It is now read-only.
/ tutorial Public archive

the tutorial repo for LitPHP

License

Notifications You must be signed in to change notification settings

litphp/tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo 1.

Hello World!

src

this demo show the minimal code to run a lit app.

Rewrite

config you web server, rewrite all request to index.php

apache

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

nginx

try_files $uri /index.php?$args;

Demo 2.

Router Basic

diff | src

this demo show how to route your app.

  • return true; within the route callback to break route chain

  • Lit_Route_Regex support route via regex on request uri

    • catch the regex match result with $app->context(Lit_Route_Regex::MATCHES)
  • set http status code via $litHttpView->status

Demo 3.

Template, Layout, everything your VIEW

diff | src

this demo show how to roll your View Layer.

  • implement Lit_ITemplate to adapt your template engine, providing the render($template, $data) method
  • extends Lit_Http_View_Template, override data() and template() method to provide $data and the template engine
  • create instance for you View class, use it as the Lit_Result
  • Layout maybe implemented by override output() method, to output some common part

About

the tutorial repo for LitPHP

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages