A micro MVC written in PHP. Inspired by Sinatra (github.com/sinatra/sinatra).
-
Download the source and place all of the files (except the “public” directory) under your public_html/www folder.
-
Place the “index.php” file within your public_html/www folder.
-
Rename “config.default.ini” to “config.ini”
-
Edit the controller/view/model files. I’ve included a basic example to get you started. NOTE: The “models” section is very bare and basic. I highly encouraging swapping it out with your own system.
-
Edit “routes.php” to reflect your changes.
In your server block…
try_files $uri $uri /index.php?path=$args;
So my server block looks like…
server {
listen 80;
server_name mvc.danieldurante.com;
index index.html index.php;
location ~ \.php$ {
include /opt/nginx/conf/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/mvc.danieldurante.com/public$fastcgi_script_name;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ {
root /srv/www/mvc.danieldurante.com/public;
expires max;
add_header Pragma public;
}
try_files $uri $uri /index.php?path=$args;
}
In your .htaccess (assuming you have mod_rewrite enabled)…
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php?path=$1
-
Fast
-
Keep it as slim as possible. For a fully featured Sinatra framework use CodeIgniter, CakePHP, or Symfony
-
Keep it classy.
I’m always looking for ways to improve Fedora as well as my other projects. Shoot me a message on here and fork the project over!