A Minimal PHP/node MVC framework
- Visual debugger
- Complete Pug support
- Complete Stylus support
- Global configuration, parameters available in PHP, Stylus, and Pug
- API endpoint assistance
- Much more I will list later
tryg is a minimal PHP framework named after Trygve Reenskaug, the inventor of the MVC structure. tryg uses Pug for templating and Stylus for CSS preprocessing, their native versions via sockets.
php ~/composer.phar require acidjazz/tryg
- Copy the bundled setup template
cp -rp vendor/acidjazz/tryg/site .
- Copy the provided package.json to install the required node modules, then use npm to install them
cp -rp vendor/acidjazz/tryg/package.json .
npm install
- Point your web server to the site/pub/ folder you've copied as the root, you're done!
Replace /var/www/tryg/site/pub
with the location of your setup template
server {
listen 80;
root /var/www/tryg/site/pub;
index index.php;
server_name tryg;
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php;
}
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
# dev env settings
fastcgi_param PHP_VALUE "short_open_tag=on \n display_errors=off \n error_reporting=E_ALL";
# prod env settings
# fastcgi_param PHP_VALUE "short_open_tag=on \n display_errors=off \n error_reporting=E_ALL";
}
}
Create a .htaccess in your setup template root folder and make sure mod_rewrite is activated
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php
refresh our test setup using tryg as a vendor
sudo pkill node;php ~/composer.phar update;rm -rf site/pub/; cp -rp vendor/acidjazz/tryg/site/ site