Skip to content

annimon-tutorials/php-unframework-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php unframework template

Fast and lightweight framework-less template for simple sites. Uses FastRoute, Twig and Pimple.

Demo: https://projects.annimon.com/

Requirements

php 7.4+

Install

composer install
chmod -R 777 cache
cd src && npm install
npm run dist
Nginx config
server {
  listen 80;
  listen [::]:80;
  listen 443 ssl;

  root /var/www/app/public;
  index index.php index.html index.htm;
  server_name app.site;
  autoindex off;

  location / {
    try_files $uri $uri/ /index.php$is_args$args;
  }
  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
  }
  location ~* ^.+\.(svg|svgz|eot|otf|woff|jpg|jpeg|gif|png|ico)$ {
    access_log off;
    expires 30d;
  }
}
Apache config
<VirtualHost *:80>
  ServerName app.site
  ServerAdmin [email protected]
  DocumentRoot /var/www/app/public

  <Directory /var/www/app>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Require all granted
  </Directory>
</VirtualHost>