Skip to content

DopparWhere Performance Meets Aristocratic Syntax

Unlock the full power of your PHP applications with ODO, Doppar’s native templating engine, and Doppar AI

✨ Doppar AI Component

Doppar AI Agents let you interact with any language model seamlessly — whether self-hosted or via OpenAI.

php
// Self-Hosted
use Doppar\AI\Agent;
use Doppar\AI\AgentFactory\Agent\SelfHost;

$response = Agent::using(SelfHost::class)
    ->withHost('http://localhost:1234')
    ->model('local-model-name')
    ->prompt('Generate a PHP function to validate email')
    ->send();

// With OpenAI
use Doppar\AI\Agent;
use Doppar\AI\AgentFactory\Agent\OpenAI;

$response = Agent::using(OpenAI::class)
    ->withKey(env('OPENAI_API_KEY'))
    ->model('gpt-3.5-turbo')
    ->prompt('Explain Doppar PHP Framework')
    ->send();

✨ Routing

With Doppar, a single line route definition gives you full routing power — HTTP method restriction, route naming, and middleware support — all declaratively, elegantly, and without boilerplate.

php
#[Mapper(prefix: 'user', middleware: ['auth'])]
class UserController extends Controller
{
    #[Route(
        uri: '/{user}',                   // Route URL; {user} is the route parameter
        methods: ['GET'],                 // Allowed HTTP method
        name: 'user',                     // Named route
        middleware: ['is_admin'],         // Middleware applied
        rateLimit: 10,                    // Max requests allowed
        rateLimitDecay: 1                 // Decay period in minutes
    )]
    public function show(#[Model] ?User $user)
    {
        // Example endpoint: http://example.com/user/aliba@doppar.com
        // `$user` is automatically resolved by email (route-model binding)

        return $user; // Returns the User model instance
    }
}

✨ Binding Services to Abstraction

Doppar allows you to inject dependencies directly at the method signature. By simply decorating a parameter, it immediately clear which concrete implementation is being used:

php
class PostController extends Controller
{
    public function __construct(
        #[Bind(PostRepository::class)] readonly private PostRepositoryInterface $postRepository
    ) {}

    #[Route('/')]
    public function __invoke(
      #[Bind(AnotherConcrete::class)] AnotherAbstract $anotherRepository
    )
    {
      //
    }
}

✨ Automatic Transaction Wrapping

Doppar allows you to automatically wrap a method (like __invoke) in a database transaction. By decorating the method with #[Transaction] attribute. This removes the traditional transaction boilerplate and collapses transaction management into a declarative, single line in your method signature:

php
class PaymentController extends Controller
{
    #[Transaction]
    #[Route('payment', methods: ['POST'])]
    public function payment()
    {
      // Automatically wraps the payment method in a DB transaction
    }
}

✨ Model Hook

Doppar’s Model Hooks provide an elegant way to tap into your models’ lifecycle events, allowing you to execute custom logic automatically during creation, updates, deletion, or booting.

php
class User extends Model
{
    protected $hooks = [
        'after_updated' => [
            'handler' => App\Hooks\UserUpdatedHook::class,
            'when' => [self::class, 'isAdmin']
        ],
    ];

    public static function isAdmin(Model $model): bool
    {
      return (int) $model->role === 'admin';
    }
}

class UserUpdatedHook
{
    public function handle(Model $model): void
    {
        if ($model->isDirtyAttr('name')) {
            info("Name changed from {$model->getOriginal('name')} to {$model->name}");
        }
    }
}

✨ Queue

The Doppar queue system is designed to handle background tasks efficiently with reliability and scalability in mind. Its feature set ensures smooth job processing, better performance, and full control over how tasks are executed.

php
#[Queueable(tries: 3, retryAfter: 10, delayFor: 300, onQueue: 'email')]
class SendWelcomeEmailJob extends Job
{
    //
}

✨ The Magic of Parameter-Level Hydration

Traditionally, a controller action receiving a POST request to create a user. With Doppar’s #[BindPayload], this entire setup collapses into a declarative, single line in your method signature:

php
public function store(Request $request) {
    // 1. Validate the request data.
    // 2. Extract the data.
    // 3. Create a new User object and fill it manually.
    $user = new User();
    $user->name = $request->input('name');
    // ... many more lines of mapping
    $user->save();
}

// With #[BindPayload] Attribute
public function store(
    #[BindPayload] User $user // The $user object is fully ready!
) {
    return User::createFromModel($user);
}

✨ Entity ORM

Doppar Entity ORM functionality with expressive reusable query, selective fields, and embedded relationships, all while keeping code clean and readable delivering pure, high-performance data handling with zero external overhead.

php
public function __active(Builder $query): Builder
{
    return $query->whereStatus(true);
}

Post::active()
    ->present('comments.reply', function ($query) {
        $query->where('approved', true);
    })
    ->search(
        attributes: [
            'title',
            'user.name',
            'category.name',
            'tags.name',
            'comments.body',
            'comments.reply.body',
        ],
        searchTerm: $request->search
    )
    ->embed(
        relations: [
            'category:id,name',
            'user:id,name',
            'tags',
        ]
    )
    ->embedCount([
        'tags',
        'comments.reply' => fn($q) => $q->where('approved', true),
    ])
    ->paginate(perPage: 10);

Why Doppar?

Doppar is engineered for speed — every repeated execution is intelligently memoized, ensuring results are delivered instantly without unnecessary reprocessing.

Blazing Fast Performance

Doppar’s highly optimized core is engineered for maximum speed—delivering near-instant response times, low latency, and seamless execution even under heavy load.

  • Lightweight architecture
  • 📉 Minimal overhead
  • 🔄 Efficient resource usage

ODO – The Doppar Templating Engine

Doppar introduces ODO, a clean, configurable, and framework-native templating engine. ODO delivers a modern, lightweight, syntax-focused approach to templating.

  • #️⃣ Fast, minimal, framework-native template compiler
  • 💉 Fully customizable syntax via config/odo.php
  • 🧩 Clean directive with 100% configurable

Entity ORM

Crafted entirely within Doppar's core, this ORM eliminates all third-party dependencies—delivering pure, high-performance data handling with zero external overhead.

  • 🔌 Fully core-powered ORM
  • 🧠 Expressive syntax
  • 🚀 High performance queries

Hook-Driven Model Architecture

Doppar’s model hooks goes beyond and a cleaner, more flexible lifecycle API with support for inline, class-based, and conditional hooks directly in the ORM core.

  • 🔌 Hook into key model stages: boot, update, etc
  • 🧠 Inline, class-based, and conditional logic
  • 🚀 Clean, testable architecture with zero clutter

Task Schedule

Doppar runs tasks with second-level accuracy, enabling real-time automation, monitoring. Perfect for applications that cannot wait for the next minute.

  • 🔔 Smart dual-mode engine (second and minute)
  • 🎉 Doppar’s built-in daemon for continuous execution
  • 🚀 If a task fails, Doppar's daemon continues running without dying

Doppar Queue

The Doppar Framework queue system is designed to handle background tasks efficiently with reliability and scalability in mind

  • 🧩 Organize jobs by priority and type
  • 📌 Configurable retry attempts with delays
  • 📈 Schedule jobs for future execution

 

Doppar Offers

Doppar offers a rich set of features out of the box — from a fast, core-powered ORM to built-in routing, validation, and concurrency controls. Everything you need to build modern, high-performance applications with zero unnecessary dependencies.

Service Container

Automatic resolutionContextual bindingsSingleton/Transient
Learn More →

Middleware

Throttle handlingGlobal/Route-specificLightweight pipeline
Learn More →

API Authentication

Stateless AuthScoped permissionsRevocable tokens
Learn More →

Rate Limiter

Dynamic throttlingRedis/File backendsCustom thresholds
Learn More →

Cache

Multi-driverTag invalidationAuto revalidation
Learn More →

Task Schedule

Exclude dateThrottle cron handlerCron with retry
Learn More →

Pool Console

Dev AccelerationClass GenerationTask Scheduling
Learn More →

Processes

ConcurrencyAsync ProcessesCommand Injection
Learn More →

Doppar Axios

Fluent HTTP ClientPromise-like SyntaxBuilt-in Retry & Timeout
Learn More →