Installation

TrueFramework ships as a Composer project template. One command gets you a working app skeleton with routing, views, and database access already wired up.

Requirements

  • PHP 8.1 or newer
  • Composer
  • A web server (Apache, nginx, or PHP's built-in server for development)
  • MySQL or SQLite if you plan to use the bundled database layer

Create a project

Use Composer's create-project with the truefw template:

composer create-project truecastdesign/truefw my-app
cd my-app

This installs the framework along with the three bundled libraries (true, hopper, welder) and lays out a starter project.

Project layout

my-app/
├── app/
│   ├── config/          # INI config files (site, database, etc.)
│   ├── controllers/     # Per-route PHP files
│   ├── views/           # .phtml templates
│   │   └── _layouts/
│   │       └── base.phtml
│   └── routes.php       # Route definitions
├── public_html/
│   ├── assets/          # CSS, JS, images
│   ├── .htaccess        # Front-controller rewrite
│   └── index.php        # Entry point
├── vendor/
├── composer.json
└── init.php             # App bootstrap

Run the dev server

From the project root:

% php -S localhost:8000 -t public_html

Open http://localhost:8000 in your browser. You should see the starter homepage.

Using DDEV

% ddev config --docroot=public_html

Add a .ddev/php/php.ini file.

memory_limit = 512M
max_execution_time = 300
max_input_time = 60
post_max_size = 100M
upload_max_filesize = 100M
short_open_tag = On
display_errors = On

Production deployments point Apache/nginx's document root at public_html/. The .htaccess in that directory rewrites every URL to index.php so the router can take over.

Configure the database

If you'll use Hopper, edit app/config/mysql.ini (or create sqlite.ini for SQLite) with your credentials. The bootstrap reads these and instantiates $App->db for you.

; app/config/MySQL.ini
[mysql]
driver   = "mysql"
host     = "localhost"
username = "root"
password = "secret"
database = "myapp"
charset  = "utf8mb4"

You can skip this entirely if you don't need a database, or wire up a different library — see Use a different DB library.