Installation


1Prerequisite

To use Temma, you need web hosting using the PHP interpreter version 8.0 or higher.

Temma can use all the databases supported by the PDO extension, as well as the noSQL Redis database, and the Memcached cache server.


2Download Temma

To create your Temma-based project, the recommended method is to use the self-extracting archive provided :

$ wget https://www.temma.net/release/download/latest -O temma.run
$ sh temma.run
$ mv temma mon_projet

If you prefer, you can extract the archive yourself:

$ wget https://github.com/Digicreon/Temma/archive/main.tar.gz
$ tar xzf main.tar.gz
$ mv Temma-main my_projet
$ chmod 777 my_projet/log my_projet/tmp

You can even clone the git repository directly:

$ git clone git@github.com:Digicreon/Temma.git mon_projet
$ chmod 777 my_projet/log my_projet/tmp
$ rm -rf my_projet/.git

3Install Smarty

If you use Temma to create an API without HTML page generation, you won't need the Smarty templating engine. Otherwise, Temma needs Smarty version 4 or higher (if you are using PHP 8.1, you will need Smarty 4.1 or higher).

You can install Smarty in two different ways: either using Composer, or by downloading the archive by hand.


3.1Composer install

To install Smarty with Composer, type this command from the project root:

$ composer require smarty/smarty

3.2Manual install

To install Smarty manually, download the archive (ZIP or TAR.GZ format) of the latest version of Smarty. Unpacking the archive, you will see a libs/ subdirectory. Rename it smarty4 and then move it inside your project's lib/ directory.

You can choose to install Smarty at system level, so you don't have to reinstall it in every project. To do this, simply copy the smarty4 directory to a directory that is part of the include paths, such as /usr/share/php (instead of putting it in your project's lib/ directory).


4Web server configuration

Once Temma has been installed, you need to configure the web server that will run your web application.
To do this, you can use Apache configuration or .htaccess files.


4.1.htaccess files

The .htaccess files are necessary in case of shared hosting.
If so, you don't have to do anything. The files are already present at the root and in the www/ directory.


4.2Apache server

The Apache configuration is to be used if you have your own dedicated server.
You will find an example file in the etc/ directory, to adapt according to your needs.

You will also need to delete the existing .htaccess files:

$ cd my_project; rm -f .htaccess www/.htaccess

5Project tree

Here is the content of a Temma project:

my_project/
        bin/
        cli/
        controllers/
        etc/
           temma.php
           apache.conf
        lib/
           Temma/
           smarty/
           smarty-plugins/
        log/
           temma.log
        templates/
        tmp/
        var/
        vendor/
        www/
           index.php
  • bin: Contains utility programs.
  • cli: Contains your command-line scripts.
  • controllers: Main directory for your controllers.
  • etc: Configuration directory
    • temma.php: Project configuration file.
    • apache.conf: "virtual host" configuration file, in the case of an Apache server.
  • lib: Base directory containing the external libraries, but also your business objects.
    • Temma: The framework code.
    • smarty: Smarty template engine.
    • smarty-plugins: Smarty plugins offered by Temma.
  • log: Directory containing the log files.
    • temma.log: Project log file.
  • templates: Directory containing the templates.
  • tmp: Directory of temporary files.
  • var: Optional directory, which can contain the data files of your application.
  • vendor: This directory does not exist by default. It is created automatically if you load external libraries with the Composer dependency management tool.
  • www: Root directory of the website, containing all CSS, Javascript and images files.
    • index.php: Main PHP script, which starts the framework.