Where To Start Editing

Add a new page

The minimal workflow is controller + route + view.

1. Create a controller method

<?php

namespace Keel\App\Controllers;

use Keel\Core\Controller;
use Keel\Core\Request;

class ExampleController extends Controller
{
    public function index(Request $request): void
    {
        $this->view('example.index', ['title' => 'Example']);
    }
}

2. Register the route in routes/web.php

use Keel\App\Controllers\ExampleController;

$router->get('/example', [ExampleController::class, 'index']);

3. Create the view

<!-- views/example/index.php -->
<?php

use EchoDial\Deck\Deck;
use Keel\Core\Theme;
?>
<!DOCTYPE html>
<html <?= Deck::htmlAttributes(lang: 'en') ?> <?= Deck::theme(mode: Theme::serverPreference()) ?>>
<head>
<?php require __DIR__ . '/../partials/head.php'; ?>
</head>
<body>
    <main class="container section">
        <h1>Example</h1>
    </main>
</body>
</html>

The two helpers on <html> are what give the page its language, light/dark theme and brand hue. Building the Interface covers them, the component classes to build the body with, and a complete worked view.

Renaming Keel for a new project

  1. Update composer.json package name.
  2. Update .env: APP_NAME, APP_URL, and DB_DATABASE.
  3. Swap brand assets in public_html/images/brand/ and matching resource images.
  4. Review landing-page copy in views/welcome.php.