DALT.PHP
Introduction

Quick Start

Install DALT and build your first route in 5 minutes

Get DALT running in 5 minutes. You'll install it, start the server, and create your first route.

Prerequisites

You need PHP 8.2+, Composer, and Node.js 18+ installed.

Check your versions:

php --version    # Should be 8.2 or higher
composer --version
node --version   # Should be 18 or higher

Installation

Create Project

composer create-project ibnuafdel/daltphp my-app "^0.3" --stability=beta --remove-vcs
cd my-app

This downloads DALT and creates a new project in the my-app directory.

Install Dependencies

composer install
npm install

This installs PHP packages and JavaScript dependencies.

Setup Database

cp .env.example .env
php artisan migrate

This creates your environment file and sets up the database. DALT uses SQLite by default, so no configuration needed.

Start Servers

Open two terminal windows:

Terminal 1 - Vite (for CSS/JS):

npm run dev

Terminal 2 - PHP Server:

php artisan serve

Open in Browser

Visit http://localhost:8000

You should see the DALT welcome page.

You're running! DALT is installed and working.

Your First Route

Let's create a simple route to see how DALT works.

Open routes/routes.php and add this at the bottom:

$router->get('/hello', function() {
    echo "Hello from DALT!";
});

Visit http://localhost:8000/hello and you'll see your message.

That's it. You defined a route and it works. No caching, no configuration, no magic.

Your First Controller

Routes can also point to controller files. Create a new file at app/Http/controllers/hello.php:

<?php

echo "Hello from a controller!";

Now update your route in routes/routes.php:

$router->get('/hello', 'hello.php');

Visit http://localhost:8000/hello again. Same result, but now the logic is in a separate file.

Your First Database Query

Let's query the database. Update app/Http/controllers/hello.php:

<?php

use Core\App;
use Core\Database;

$db = App::resolve(Database::class);

$users = $db->query('SELECT * FROM users')->get();

echo "Found " . count($users) . " users";

Visit http://localhost:8000/hello and you'll see how many users exist (probably 0 right now).

Next Steps

You now have DALT running and understand the basics. Here's what to explore next:

Build something real: Follow the Building a Blog guide to create a complete application from scratch.

Learn the concepts: Check out the sidebar for guides on routing, database, authentication, and more.

Try the challenges: If you want structured practice, explore the Lessons and Challenges sections in the sidebar.

Common Issues

Port already in use?

php artisan serve --port=8001

Database errors?

php artisan migrate:fresh

Vite not loading? Make sure npm run dev is running in a separate terminal.

Permission errors?

chmod -R 775 storage database

On this page