Installation
1Prerequisite
To use Temma, you need web hosting using the PHP interpreter version 8.3 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.
2Installation with an AI agent
This is the shortest path. If you work with a coding agent (Claude Code, OpenAI Codex, GitHub Copilot…), give it this sentence:
Create a website using Temma (temma.net/go) |
The agent reads the llms-install.md file, an executable installation guide that tells it how to check the prerequisites, create the project, configure the database, set up the web server, and check that the home page responds. Everything the following sections describe is therefore done for you.
See the AI skills page for the details of what this guide does, and for carrying on the work with an agent.
3Installation with Composer
If you have the Composer dependency manager installed on your computer, you can use it to create a Temma-based project.
To create a website project:
$ composer create-project digicreon/temma-project-web my_site |
To create an API project:
$ composer create-project digicreon/temma-project-api my_api |
The difference:
- A web project returns mainly HTML pages, and therefore embeds the Smarty template engine.
- An API returns JSON streams by default, and manages its authentication via public/private key pairs. It therefore does not embed Smarty, and activates the API plugin.
4Installation without Composer
If you don't have Composer installed on your computer, or don't want to use it, Temma provides an easy-to-use installation script. You can even simply clone a Git code repository.
4.1Stable version
To create your project based on the latest stable version of Temma:
$ curl -Ls https://temma.net/release | sh - |
Or, for short:
$ curl -Ls temma.net/r | sh - |
The script will prompt you for the name of the destination directory to be created. The default name is temma_project.
If you prefer, you can extract the archive yourself.
The latest stable version of Temma is 2.22.0.
$ wget https://github.com/Digicreon/Temma/archive/refs/tags/2.22.0.tar.gz $ tar xzf 2.22.0.tar.gz $ mv Temma-2.22.0 my_project $ chmod 777 my_project/log my_project/tmp
4.2Latest version of sources
You can download the latest versions of Temma sources. These sources are undergoing testing (which is why they are not yet part of a stable release) and may contain bugs.
Once again, an installation script is provided:
$ curl -Ls https://temma.net/release/latest | sh - |
Or, for short:
$ curl -Ls temma.net/r/l | sh - |
Once again, the script will prompt you for the name of the destination directory to be created. The default name is temma_project.
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_project $ chmod 777 my_project/log my_project/tmp
You can even clone the git repository directly:
$ git clone git@github.com:Digicreon/Temma.git my_project $ chmod 777 my_project/log my_project/tmp $ rm -rf my_project/.git
4.3Install Smarty
If you use Temma to create an API without HTML page generation, you won't need the Smarty templating engine. Otherwise, Temma works equally well with Smarty 4 or Smarty 5. Smarty 4 is compatible with PHP 7.1 to 8.4, and Smarty 5 with PHP 7.2 to 8.5. Since Temma requires PHP 8.3 or higher, both Smarty versions are suitable; you simply need to use Smarty 5 if you are running PHP 8.5.
Please note that Smarty version 5 introduces changes that are not backward-compatible.
Please note that Smarty version 5.4.0 (or higher) is highly recommended. Temma enables the auto-escape option for variables, which eliminates the need to use the escape modifier. However, Smarty versions prior to 5.4.0 do not offer the raw modifier, which allows you to cancel auto-escape when necessary. However, it is possible to disable auto-escape by default.
You can install Smarty in two different ways: either using Composer, or by downloading the archive by hand.
To install the latest stable version of Smarty with Composer, type this command from the project root (more information in the documentation):
$ composer require smarty/smarty |
To install Smarty manually, download the archive (ZIP or TAR.GZ format) of the desired version. Unpacking the archive, you will see a libs/ (Smarty 4) or src/ subdirectory. Rename it smarty4 (Smarty 4) or Smarty (Smarty 5) and then move it inside your project's lib/ directory.
5Web 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/Nginx configuration or .htaccess files.
5.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 (.htaccess at the root and www/.htaccess).
5.2Apache or Nginx server
Use the Apache or Nginx configuration if you have your own server (dedicated, virtual or Docker container).
You'll find example configurations (files etc/apache.conf and etc/nginx.conf), which you can modify to suit your needs.
You will also need to delete the existing .htaccess files:
$ cd my_project
$ rm -f .htaccess www/.htaccess
6Project 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 (for installations without Composer).
- Smarty (or smarty4): Smarty template engine (for installations without Composer).
- 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 exists if you have installed Temma using Composer, or if you have loaded external libraries with Composer.
-
www: Root directory of the website, containing all CSS, Javascript and images files.
- index.php: Main PHP script, which starts the framework.