Quick Start
Get DALT.PHP running in 5 minutes
Get DALT.PHP up and running in just 5 minutes and complete your first challenge!
Prerequisites
Before you begin, ensure you have:
- PHP 8.2+ - Download PHP
- Composer - Install Composer
- Node.js 18+ - Download Node.js
- Git - Install Git
Check your versions:
php --version # Should be 8.2 or higher
composer --version
node --version # Should be 18 or higher
npm --versionInstallation
Clone the Repository
git clone https://github.com/Ibnu-Afdel/DALT.PHP.git
cd DALT.PHPInstall Dependencies
# Install PHP dependencies
composer install
# Install platform dependencies (Node/Vite)
npm run install-platformPlatform dependencies are installed in the hidden .dalt/ directory,
keeping your workspace clean and focused on PHP learning.
Setup Environment
# Copy environment file
cp .env.example .env
# Run database migrations
php artisan migrateThe default configuration works out of the box with SQLite.
Start Development Servers
You need two terminals running simultaneously:
Terminal 1 - Vite Dev Server:
npm run devTerminal 2 - PHP Server:
php artisan serveInstallation Complete! 🎉
You're now ready to start learning backend development by debugging real code.
Your First Challenge
Let's complete the "Broken Routing" challenge to see how DALT.PHP works. This challenge comes with all the files you need - you'll copy them into your workspace.
Understand the Concept
Visit http://localhost:8000/learn in your browser and click on "Lesson 2: Routing" to learn how routing works.
Take a few minutes to read through the lesson - it explains the concepts you'll be debugging.
Copy the Challenge Files
The challenge includes broken code files that you'll copy into your workspace. In your terminal, run:
# Backup your current routes (just in case)
cp routes/routes.php routes/routes.php.backup
# Copy the broken routes file
cp course/challenges/broken-routing/routes/routes.php routes/
# Copy the posts controllers (these come with the challenge)
cp -r course/challenges/broken-routing/Http/controllers/posts app/Http/controllers/The challenge includes everything you need: broken routes AND the controllers that use them. You're copying a complete (but buggy) feature into your workspace.
See What's Broken
Open your browser and test these URLs:
- ✅ http://localhost:8000/posts - Works! Shows list of posts
- ❌ http://localhost:8000/posts/create - Broken! Shows wrong page
- ❌ http://localhost:8000/posts/1/edit - Broken! 404 error
The URLs don't work as expected. Your job is to figure out why!
Run the Tests
DALT.PHP includes automated tests that check your work. Run:
php artisan verify broken-routingYou'll see helpful output like:
✓ Route get /posts/create exists
✓ Route get /posts/{id}/edit exists
✗ Route order wrong: /posts/create should come before /posts/{id}
💡 Hint: Move /posts/create BEFORE /posts/{id} in routes/routes.php
✗ File still contains: // $router->get('/posts/{id}/edit'
💡 Hint: Remove the // comment from the edit route
Results: 2/4 tests passedThe hints tell you exactly what to look for!
Fix the Bugs
Open routes/routes.php in your code editor. You'll see the broken routes. Fix both bugs:
Bug #1 - Wrong Route Order:
The specific route /posts/create comes AFTER the generic route /posts/{id}, so the router matches "create" as an ID. Swap them:
// WRONG ORDER
$router->get('/posts/{id}', 'posts/show.php');
$router->get('/posts/create', 'posts/create.php'); // Never matches!
// CORRECT ORDER
$router->get('/posts/create', 'posts/create.php'); // Specific first
$router->get('/posts/{id}', 'posts/show.php'); // Generic afterBug #2 - Commented Route:
The edit route is commented out. Remove the //:
// BEFORE
// $router->get('/posts/{id}/edit', 'posts/edit.php');
// AFTER
$router->get('/posts/{id}/edit', 'posts/edit.php');Save the file!
Verify Your Fix
Run the tests again:
php artisan verify broken-routingYou should see all tests pass:
✓ Route get /posts/create exists
✓ Route get /posts/{id}/edit exists
✓ Route order correct: specific before generic
✓ No problematic code found
Results: 4/4 tests passed
🎉 All tests passed! Challenge completed successfully.Test in Browser
Go back to your browser and verify everything works:
- ✅ http://localhost:8000/posts/create - Now shows create form!
- ✅ http://localhost:8000/posts/1/edit - Now shows edit form!
Success! 🎉
Congratulations! 🎉
You've completed your first DALT.PHP challenge! You now understand:
- Why route order matters (specific before generic)
- How routers match URL patterns
- How to debug routing issues
This is how DALT.PHP works - you copy broken code, debug it, fix it, and verify your solution!
What You Learned
In just 5 minutes, you:
- ✅ Installed DALT.PHP
- ✅ Read a lesson about routing
- ✅ Encountered broken code
- ✅ Debugged and fixed 2 bugs
- ✅ Verified your solution with automated tests
- ✅ Understood routing concepts deeply
This is the DALT.PHP learning experience!
Next Steps
Complete All Challenges
Continue with Challenge 2: Broken Middleware
Explore the Framework
Understand how DALT.PHP works internally
Build Something
Create a complete blog application from scratch
Troubleshooting
Port Already in Use
If port 8000 or 5173 is already in use:
# Use different port for PHP
php artisan serve --port=8001
# Kill process on port 5173
lsof -ti:5173 | xargs kill -9Database Errors
If you get database connection errors:
# Check database file exists
ls -la database/app.sqlite
# Re-run migrations
php artisan migrate:freshVite Assets Not Loading
If Vue components don't work:
- Ensure Vite dev server is running (
npm run dev) - Check browser console for errors
- Try clearing browser cache
- Restart both servers
Permission Errors
If you get permission errors:
# Fix storage permissions
chmod -R 775 storage
chmod -R 775 databaseCLI Commands Reference
Quick reference for common commands:
# Development servers
npm run dev # Start Vite dev server
php artisan serve # Start PHP server
# Database
php artisan migrate # Run migrations
php artisan migrate:fresh # Reset and re-run migrations
# Verification
php artisan verify broken-routing # Verify specific challenge
php artisan verify # List all challenges
# Migrations
php artisan make:migration create_posts_table # Create new migrationGetting Help
If you're stuck:
- Check the docs - Most questions are answered here
- Read error messages - They often tell you exactly what's wrong
- Join Telegram - t.me/daltphp for community help
- Open an issue - GitHub Issues
Tips for Success
1. Read Lessons First
Always read the lesson before attempting the challenge. Understanding the concept makes debugging much easier.
2. Use Verification Often
Run php artisan verify frequently. The hints will guide you in the right direction.
3. Read Framework Code
The framework source in framework/Core/ is readable and educational. Don't be afraid to explore it!
4. Take Notes
Document what you learn. Writing reinforces understanding.
5. Don't Rush
Take time to understand why the bug exists and why your fix works. Deep understanding beats speed.
You're all set! Start with Lesson 1: Request Lifecycle or jump straight into Challenge 2: Broken Middleware. Happy debugging! 🐛🔧