xergio / cecina

super-mini-framework for web development in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Things to get in mind: 

Configure your web server to handle all requests to public/index.php

The rest of files have the same name than the class.

Default controller name: AppController
Default action name: index

The bootstrap is in sys/loader.php. Include it to load the entire app as you can see in the index.php

The URL format is: /controller/action/some/extra/and/optional/params?query=string

In each app controller there are some predefined variables:
- $this->context = object with routing and environment data and extra params in the path
- $this->request = $_REQUEST
- $this->result for "after" method

The executed action returns the template variables

The templates are in templates/ folder
- There is a default public.html and error.html layouts
- Each action has a template with this format: controller/action.html 

Im planning to add support for medias (html, json, xml...), for now .html by default without other options.

In templates you can use the returned vars by the action in flat format like <?=$var_name?>, or one of $request or $context as array.

To start, simply extend the AppController class and overwrite the "index" action if you want.

Browse to /test to see how exceptions work.

Too much work left to do!


Apache configuration example:

<VirtualHost *:80>
    ServerName dev.server

    DocumentRoot /var/www/cecina/public

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
        RewriteRule ^(.*)$ /var/www/cecina/public/index.php [L]
    </IfModule>
</VirtualHost>

About

super-mini-framework for web development in PHP


Languages

Language:PHP 100.0%