Larafony 2.0 – free* course updated to PHP 8.5
        You can learn from the extensive README repository
        
            github.com/DJWeb-Damian-Jozwiak/larafony
        .
        
        But if you want to understand each element step by step –
        check out the full PHP 8.5 course as an ebook 📚,
        where I explain everything in detail.
    
We don't need another tutorial boilerplate. We need tools for real work. That's why Larafony was created – a combination of Laravel's elegance, Symfony's reliability, and the power of modern PHP 8.5. Not as a package, but as a full-fledged production framework.
Version 2.0 is not just PHP 8.5 compatibility (pipe operator, array_first/last, fatal error backtraces), but also a complete refactor of key components: Clock, HTTP Kernel, Routing, and ORM. Everything described step by step in the Larafony course chapters.
1. Clock – PSR-20 Time Handling (Chapter 3)
Instead of Carbon or DateTime, Larafony relies on pure PSR-20 with full support for testability and mocking.
<?php
use Larafony\Clock\SystemClock;
use Larafony\Clock\FrozenClock;
$clock = new SystemClock();
echo $clock->format('Y-m-d H:i:s');
$testClock = FrozenClock::fromString('2025-10-21 12:00:00');
$testClock->advance('+1 hour');Comparison: Larafony vs Carbon vs Symfony Clock
| Feature | Larafony Clock (PSR-20) | Laravel Carbon | Symfony Clock | 
|---|---|---|---|
| PSR Standard | ✅ PSR-20 native | ❌ Proprietary API | ✅ PSR-20 | 
| Testability | ✅ FrozenClock (mock) | ⚙️ Carbon::setTestNow() | ✅ MockClock() | 
| Dependency Injection | ✅ ClockInterface (PSR-20) | ❌ Global static (based on PSR-20) | ✅ Service Container | 
| Time Formatting | ✅ Enum TimeFormat::ISO8601 | ✅ Carbon methods | ❌ No helpers | 
| Requirements | PHP 8.5+, zero dependencies | Carbon package | Symfony Component | 
2. HTTP Kernel and Routing – PSR-7/15 (Chapters 5 and 15)
Larafony uses attribute-based routing and a full PSR-7/15 stack instead of Laravel's magic or Symfony's heavy config. Every controller is a pure PHP object.
<?php
use Larafony\Routing\Attribute\Route;
use Psr\Http\Message\ResponseInterface;
#[RouteGroup('blog')]
final class BlogController
{
    #[Route('/posts/<id:\d+>', 'GET', name: 'posts.show')]
    public function show(
        ServerRequestInterface $request,
        #[RouteParam(model: Post::class, findMethod: 'findOrFail')]
        Post $post
    ): ResponseInterface
    {
        // $post is automatically fetched from database
        // Throws 404 if not found (using findOrFail)
        return $this->json(['post' => $post]);
    }
    #[Route('/posts/<slug:[a-z-]+>', 'GET', name: 'posts.by-slug')]
    public function showBySlug(
        ServerRequestInterface $request,
        #[RouteParam(model: Post::class, findMethod: 'findBySlug')]
        Post $post
    ): ResponseInterface
    {
        // Uses custom finder method
        return $this->json(['post' => $post]);
    }
}Routing and Middleware Comparison
| Feature | Larafony (PSR-7/15) | Laravel | Symfony | 
|---|---|---|---|
| Route Definition | ✅ PHP Attributes | 📄 routes/web.php | 📜 annotations or YAML | 
| Middleware Stack | ✅ Declarative PSR-15 | ⚙️ Kernel.php class-based | ⚙️ EventSubscriber | 
| Production Performance | 🚀 Route Cache + Compiled Routes | 🟡 Route Cache | 🟠 Annotation Compilation | 
| Route Parameters | ✅ Regex + type hints | 🟡 implicit binding | ✅ ParamConverter | 
| PSR Compliance | ✅ full (7, 15, 17) | ❌ custom interfaces | 🟡 partial PSR-7 | 
3. ORM with Property Observers (Chapter 13)
Larafony's ORM is a hybrid of ActiveRecord and EntityFramework – full property change tracking thanks to PHP 8.5 property hooks.
<?php
class Post extends Model
{
    public string $table { get => 'posts'; }
    public ?string $title {
        get => $this->title;
        set {
            $this->title = $value;
            $this->markPropertyAsChanged('title');
        }
    }
    #[BelongsTo(related: User::class, foreignKey: 'user_id', ownerKey: 'id')]
    public ?BelongsToRelation $user {
        get => $this->relations->get('user');
    }
    public ?int $user_id {
        get => $this->user_id;
        set {
            $this->user_id = $value;
            $this->markPropertyAsChanged('user_id');
        }
    }
}ORM Comparison – Larafony vs Eloquent vs Doctrine vs .NET EF
| Feature | Larafony ORM | Laravel Eloquent | Doctrine ORM | .NET Entity Framework | 
|---|---|---|---|---|
| Pattern | ActiveRecord + Observers | ActiveRecord | DataMapper | Change Tracking | 
| Change Tracking | ✅ Property Observers | ⚙️ Dirty Checking | 🟡 UnitOfWork | ✅ Auto Change Tracking | 
| Model Definition | PHP 8.5 property hooks | class $fillable | annotations/XML | C# POCO class | 
| Typing | ✅ strict typed | 🟡 mixed fields | 🟡 hydrated objects | ✅ strong typed | 
| Relations | ✅ lazy / eager load / attribute-defined | ✅ hasMany / belongsTo | ✅ mappedBy / cascade | ✅ navigation props | 
| Performance | 🚀 Ultra-light | 🟡 medium | 🟠 heavy | 🟡 medium | 
4. PHP 8.5 Features in Practice
        Thanks to the pipe operator (|>) and array_first()/array_last() functions, Larafony code is shorter and more readable:
    
$title = $request->input('title')
    |> trim(...)
    |> strtolower(...)
    |> (static fn(string $t) => ucfirst($t));
$user = $users
    |> (static fn($data) => array_filter($data, static fn($u) => $u['active']))
    |> (static fn($data) => array_first($data));5. Summary
Larafony 2.0 is a framework for those who appreciate Laravel's simplicity, Symfony's robustness, and PHP 8.5's modernity – without unnecessary overhead. This is code written for production, and the course is its open documentation.
Larafony 1.0 (known as the "PHP course") used Carbon, Twig, Faker, Symfony VarDumper, and Symfony Mailer. Larafony 2.0 will probably use Symfony Mailer (though I might implement emails from scratch) and Twig (as an optional package in a separate repository – not required by the main framework). Thanks to this, we can consider Larafony 2.0 a zero-dependency framework (PSR only).
🔗 Repository (PHP8.5): github.com/DJWeb-Damian-Jozwiak/larafony 🔗 Repository (PHP8.4): github.com/DJWeb-Damian-Jozwiak/book
🎓 Want to understand how a framework is built from scratch?
Larafony is a framework written from scratch, module by module, with full PSR compliance and the new PHP 8.5 standard. 🎁 Buy now and receive a free PHP 8.5 update in December 2025! Since January 2026, both courses will be available together (at a higher price) or separately (at the current price)