acidjazz/tryg

Minimal PHP Framework

v0.4.0 2016-07-17 22:12 UTC

README

A Minimal PHP/node MVC framework

Latest Stable Version Total Downloads Latest Unstable Version License Join the chat at https://gitter.im/acidjazz/tryg

features

  • Visual debugger 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

what?

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.

installation

  1. Install Composer
  2. Install the specified Packagist acidjazz/tryg
php ~/composer.phar require acidjazz/tryg
  1. Copy the bundled setup template
cp -rp vendor/acidjazz/tryg/site .
  1. 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
  1. Point your web server to the site/pub/ folder you've copied as the root, you're done!

Nginx setup

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";
	}

}

Apache setup

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

dev notes

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