2017 © Pedro Peláez
 

library easy-twig

Easy twig

image

demontpx/easy-twig

Easy twig

  • Monday, July 16, 2018
  • by DemonTPx
  • Repository
  • 1 Watchers
  • 1 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Easy Twig

Build Status, (*1)

Easy twig is a very small and simple framework to get started with Twig quickly., (*2)

Just start editing the templates/page/index.html.twig to start filling in your front page and templates/base.html.twig to modify the skeleton. To add a new page, for example a 'contact' page, just create the templates/page/contact.html.twig file and you're done! See pages., (*3)

If a page can not be found, the template templates/error/404.html.twig will be rendered., (*4)

Getting started

Create a new project based on easy twig:, (*5)

composer create-project demontpx/easy-twig <folder_name>

Pages

Assuming your projects runs on the domain.tld domain:, (*6)

  • templates/page/index.html.twig will be the homepage of the project, accessible through http://domain.tld/
  • templates/page/error/404.html.twig contains the "Not found" error page
  • Any template outside templates/page/ will not be directly accessible for the user and should be used to contain inherited, included and other templates
  • Any page inside templates/page/ will be directly accessible by its name; for example:
Template URL
contact.html.twig http://domain.tld/contact
information/about-us.html.twig http://domain.tld/information/about-us
contact-us/index.html.twig http://domain.tld/contact-us/

Note that removing the last slash will try to access contact-us.html.twig, (*7)

Configuration

Check out the .env file for configuration settings., (*8)

Setting up apache2

Set the document root to the web/ folder. You also might want set AllowOverride All and enable mod_rewrite for some pretty URLs. Your configuration might look a bit like this:, (*9)

<VirtualHost *:80>
    ServerName domain.tld
    ServerAlias www.domain.tld

    DocumentRoot /var/www/website/public
    <Directory /var/www/website/public>
        AllowOverride All
    </Directory>
</VirtualHost>

Setting up Nginx

Configuration might look a bit like this:, (*10)

server {
    server_name domain.tld www.domain.tld;
    root /var/www/website/public;

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location ~ ^/index\.php(/|$) {
        fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;

        internal;
    }
}

The Versions

16/07 2018

dev-master

9999999-dev

Easy twig

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Hekman

16/07 2018

0.2

0.2.0.0

Easy twig

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Hekman

14/02 2015

0.1.1

0.1.1.0

Easy twig

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Hekman

23/10 2014

0.1.0

0.1.0.0

Easy twig

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Hekman

17/10 2014

0.1

0.1.0.0

Easy twig

  Sources   Download

MIT

The Requires

 

by Bert Hekman