Installation
Last updated: 2026-11-06
Get Canvas Framework up and running in just a few minutes with Composer.
System Requirements
- PHP 8.3 or higher
- Composer for dependency management
- Web server (Apache, Nginx, or PHP built-in server)
Create a New Project
Create a new Canvas application using the skeleton project:
composer create-project quellabs/canvas-skeleton my-canvas-app
cd my-canvas-app Add Canvas to Existing Project
To add Canvas to an existing project, install it via Composer:
composer require quellabs/canvas Create a `public` folder and copy essential files
To create a public folder with the main driver file index.php and a .htaccess file, run:
composer require quellabs/canvas-apache Configuration file
Canvas works without a config file using its built-in defaults. To override them, generate config/app.php with Sculpt:
./vendor/bin/sculpt canvas:init This writes a config/app.php with sensible defaults for the directory layout, template engine, output filter, annotation source, and the basic security header policy, creating the config/ directory if needed. Pass --force to overwrite an existing file. See CLI for details.
The generated file looks like this:
<?php
return [
// True to put the framework in debug mode; this mainly affects caching
'debug_mode' => true,
// Directory the web server document root is set to
'public_directory' => 'public',
// Template engine
'template_engine' => 'smarty',
// Optional OutputFilterInterface class, or an ordered list of classes applied
// in turn; use \Quellabs\Canvas\Output\HtmlMinifyFilter::class to minify HTML.
'output_filter' => null,
// Path to controller classes
'controller_directory' => dirname(__FILE__) . '/../src/Controllers',
// Path to error handlers
'error_handler_directory' => dirname(__FILE__) . '/../src/Errors',
// Path to aspect-oriented programming files
'aspect_directory' => dirname(__FILE__) . '/../src/Aspects',
// Path to signal listeners
'signal_listeners_path' => dirname(__FILE__) . '/../src/Listeners',
// Whether to match routes with trailing slashes
'match_trailing_slashes' => false,
// Metadata source for annotations: Configuration::SOURCE_DOCBLOCKS (@Route(...))
// or SOURCE_ATTRIBUTES (#[Route(...)])
'annotation_source' => \Quellabs\AnnotationReader\Configuration::SOURCE_DOCBLOCKS,
// Default SecurityHeaderPolicyInterface implementation, or null to disable
'security_header_policy' => \Quellabs\Canvas\Security\Policies\BasicSecurityHeaderPolicy::class
]; You're free to edit the file by hand afterward — Sculpt only writes it once.
Project Structure
Canvas follows a conventional directory structure:
my-canvas-app/
├── public/
│ ├── index.php # Application entry point
│ └── .htaccess # Apache configuration with URL rewriting
├── src/
│ ├── Controllers/ # Your controllers
│ ├── Aspects/ # AOP aspects
│ └── Errors/ # Error handlers
├── templates/ # Templates (usually Smarty)
├── storage/ # Runtime files
├── config/ # Configuration files
└── vendor/ # Composer dependencies