Quick Start
Last updated: 2026-10-31
Build and run your first Canvas app in four steps. You will create a project, add a route, render a Smarty template, and open the result in your browser.
Step 1: Create a Canvas project
You need PHP 8.3 or higher and Composer. Create an app from the Canvas skeleton, then enter its directory:
composer create-project quellabs/canvas-skeleton my-canvas-app
cd my-canvas-app The skeleton includes the public/ entry point and the directories used below. For other installation options, see the Installation guide.
Step 2: Add a controller and route
Create src/Controllers/HomeController.php with this code:
<?php
namespace App\Controllers;
use Quellabs\Canvas\Annotations\Route;
use Quellabs\Canvas\Controllers\BaseController;
use Symfony\Component\HttpFoundation\Response;
class HomeController extends BaseController {
/**
* @Route("/")
*/
public function index(): Response {
return $this->render('home.tpl', ['message' => 'Hello, Canvas!']);
}
} Canvas discovers controllers in src/Controllers/. The @Route("/") annotation connects the home URL to index(), which passes a message to the template.
Step 3: Create the template
Create templates/home.tpl:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My Canvas App</title>
</head>
<body>
<h1>{$message}</h1>
<p>My first Canvas page is running.</p>
</body>
</html> Smarty replaces {$message} with the value passed by the controller.
Step 4: Run the app
From the project directory, start PHP's development server:
php -S localhost:8000 -t public/ Open http://localhost:8000/. You should see Hello, Canvas! above the text “My first Canvas page is running.”