Skip to content

Compare With Laravel ​

Introduction ​

DotBlaze follows Laravel's structure, so its concepts, facades, and most method names carry over. The table below shows the same task in both frameworks. Features marked Not Yet are not built in DotBlaze. The roadmap lists what may come next.

Feature Comparison ​

FeatureLaravelDotBlaze
Console Commandsphp artisan migratedotblaze migrate
AuthenticationAuth::login($user)await Auth.Login(user)
AuthorizationGate::authorize('update', $post)await Gate.Authorize("update", post)
CacheCache::put('key', 'value', 60)await Cache.Put("key", "value", TimeSpan.FromMinutes(1))
Collectionscollect([1, 2, 3])->map(...)Collect(new[] { 1, 2, 3 }).Map(...)
Configconfig('app.name')Config.Get<string>("app.name")
CookiesCookie::queue('theme', 'dark')Cookie.Queue("theme", "dark")
ContextContext::add('request_id', $id)Context.Add("request_id", id)
DatesDate::now()Date.Now, Date.Freeze(instant)
Error Handling->withExceptions(fn ($e) => $e->report(...)), abort(404)Exceptions.Report<T>(...), Abort(404)
EncryptionCrypt::encryptString('text'), APP_KEY, php artisan key:generateCrypt.Encrypt("text"), APP_KEY, dotblaze key:generate
CSRF Protection@csrf, 419 Page Expired@Csrf(), 419 Page Expired
DatabaseDB::table('users')->get()await DB.Table("users").Get()
Email VerificationMustVerifyEmailIMustVerifyEmail
EventsOrderShipped::dispatch($order)await Event.Dispatch(new OrderShipped(order))
Framework EventsDB::listen(fn ($query) => ...)Instrumentation.Listen<QueryExecuted>(q => ...)
File StorageStorage::put('file.txt', 'content')await Storage.Put("file.txt", "content")
HashingHash::make('password')Hash.Make("password")
HelpersStr::slug('Hello World')Str.Slug("Hello World")
HTTP ClientHttp::get('https://example.com')await Http.Get("https://example.com")
Live Components (Livewire)<livewire:counter /><live:counter />
Persistent MiddlewareLivewire::addPersistentMiddleware([...])Automatic for every route middleware and .Can check
LoggingLog::info('message')Log.Info("message")
MailMail::to($user)->send(new OrderShipped($order))await Mail.To(user).Send(new OrderShipped { Order = order })
MiddlewareRoute::middleware('auth').Middleware("auth")
Middleware Parameters->middleware('role:admin,editor').Middleware("role:admin,editor")
Middleware Groupsweb / api groupsweb (default) / api groups, Route.MiddlewareGroup(...)
Excluding Middleware->withoutMiddleware('csrf').WithoutMiddleware("csrf")
Throttling->middleware('throttle:60,1'), RateLimiter::for('api', ...).Middleware("throttle:60,1"), RateLimiter.For("api", ...)
Trim StringsTrimStringstrim-strings (in web and api)
MigrationsSchema::create('posts', ...)Schema.Create("posts", t => ...)
MockingMail::fake()Mail.Fake()
Models (Eloquent)User::find(1)await User.Find(1)
Find or CreateUser::firstOrCreate([...], [...])await User.FirstOrCreate(new { ... }, new { ... })
Global Model ScopesPost::addGlobalScope(...)Post.AddGlobalScope("published", p => p.Published)
Relationship AggregatesAuthor::withCount('books')->get()await Author.Query().WithCount(a => a.Books).Get()
Pivot Operations$book->tags()->sync($ids)await book.ManyToMany(b => b.Tags).Sync(ids)
Polymorphic RelationsRelation::morphMap([...]), $comment->commentableModel.MorphMap<Post>("post"), await Model.MorphTo(type, id)
Quiet Saves$post->saveQuietly()await post.SaveQuietly()
Per-Instance JSON$user->makeHidden('email')user.MakeHidden("Email")
Notifications$user->notify(new InvoicePaid($invoice))await user.Notify(new InvoicePaid { Invoice = invoice })
PaginationPost::paginate(10)await Post.Query().Paginate(10)
Password ResetPassword::sendResetLink($credentials)await Password.SendResetLink(...)
QueuesSendEmail::dispatch()await new SendEmail { ... }.Dispatch()
Rate LimitingRateLimiter::tooManyAttempts($key, 5)await RateLimiter.TooManyAttempts(key, 5)
RedisRedis::get('key')await Redis.Connection().StringGetAsync("key")
Responsesreturn back()->with('status', '...')return Back().With("status", "...")
RoutingRoute::get('/', [HomeController::class, 'index'])Route.Get<HomeController>("/", c => c.Index)
Seeding$this->call(UserSeeder::class)await Call<UserSeeder>()
Testing$this->get('/posts')->assertOk()(await client.Get("/posts")).AssertOk()
URL GenerationURL::signedRoute('unsubscribe', ...)URL.SignedRoute("unsubscribe", ...)
ValidationFormRequestFormRequest<TSelf>
Standalone ValidationValidator::make($input, $rules)await Validator.Validate(input, rules => ...)
Viewsview('welcome')View("welcome") (Blade or Razor)
Blade Templates@foreach ($posts as $post) {{ $post->title }} @endforeach@foreach (var post in Model.Posts) {{ post.Title }} @endforeach
Rendering Blade StringsBlade::render($template, ['user' => $user])BladeTemplate.Compile(template).Render(new { user }) (sandboxed)
API Tokens (Sanctum)$user->createToken('api')await user.CreateToken("api")
Broadcastingbroadcast(new OrderShipped($order))->toOthers()await Broadcast.Send(new OrderShipped(order)).ToOthers()
Private & Presence ChannelsBroadcast::channel('orders.{id}', ...)Broadcast.Channel("orders.{id}", ...)
Components (Blade)<x-alert type="error" /><x-alert type="error" />
Cursor PaginationPost::cursorPaginate(15)await Post.Query().CursorPaginate(p => p.Id)
Database Cache Store'driver' => 'database'driver = "database"
Job Chaining & BatchingBus::chain([...])->dispatch()await Bus.Chain(...).Dispatch()
Job Middlewarenew WithoutOverlapping($id)new WithoutOverlapping(id)
Unique JobsShouldBeUniqueIShouldBeUnique
Localization__('messages.welcome')__("messages.welcome")
Maintenance Modephp artisan down --secret=...dotblaze down --secret=...
Model FactoriesUser::factory()->count(10)->create()await User.Factory().Count(10).CreateMany()
ObserversUser::observe(UserObserver::class)User.Observe<UserObserver>() or [ObservedBy(...)]
Package Development$this->loadViewsFrom($path, 'courier')[assembly: DotBlazePackage], View("courier::welcome")
Password Confirmation->middleware('password.confirm').Middleware("password.confirm")
ProcessesProcess::run('ls -la')await Process.Run("ls -la")
PipelinesPipeline::send($value)->through([...])->thenReturn()await Pipeline.Send(value).Through(...).ThenReturn()
Calling CommandsArtisan::call('route:list')await Artisan.Call("route:list")
ImagesImageImage.Read(bytes).Resize(1200, 800) (DotBlaze.Image)
AI SDKagent()->prompt('...')await Ai.Agent().Prompt("...") (DotBlaze.AI; see the provider matrix)
Vite@vite('resources/js/app.js')@Vite.Assets("resources/js/app.js")
Sessionsession(['key' => 'value'])await Session.Put("key", "value")
Social Login (Socialite)Socialite::driver('github')->redirect()await Socialite.Driver("github").Redirect()
Task SchedulingSchedule::command('emails:send')->daily()Schedule.Command("emails:send").Daily()
Testing Helpers$this->actingAs($user)->post(...)->assertRedirect()(await client.ActingAs(user).Post(...)).AssertRedirect()
Tinkerphp artisan tinkerdotblaze tinker
Two-Factor Authentication (Fortify)TwoFactorAuthenticatableITwoFactorAuthenticatable, TwoFactor.Enable(user)
ULIDsStr::ulid()Str.Ulid()
Horizonphp artisan horizon, /horizondotblaze queue:manager, /horizon (DotBlaze.Horizon)
Telescope/telescope, Telescope::filter(...)/telescope, Telescope.Filter(...) (DotBlaze.Telescope)
Pulsephp artisan pulse:check, /pulsedotblaze pulse:check, /pulse (DotBlaze.Pulse)
Scout (full-text search)Post::search('term')Not Yet

AI SDK Comparison ​

DotBlaze.AI follows the Laravel AI SDK's concepts with C# types and asynchronous APIs. Provider/model support varies: this is an API correspondence, not a claim that every provider supports every operation. See the provider matrix for details.

FeatureLaravel AI SDKDotBlaze
Named agentsSalesCoach::make()->prompt('...')await SalesCoach.Make().Prompt("...")
Agent configurationProvider, model, temperature, token/step limits, timeout, cheapest/smartest attributes[Provider], [Model], [Temperature], [MaxTokens], [MaxSteps], [Timeout], [UseCheapestModel], [UseSmartestModel]
ConversationsRemember and continue conversationsForUser(...), Continue(...), owner-scoped listing, pagination, and deletion
Structured outputAgent output schemasStructured<T>(), JSON Schema and recursive data-annotation validation
ClassificationBoolean, choice, and score questionsClassification.Of(...).Boolean(...), .Choice(...), .Score(...), plus label classification
Tools and MCP clientsAgent tools and external MCP toolsTools(), AIFunctionFactory.Create(...), MCP AIFunction integration
Provider-hosted toolsWeb search, web fetch, file searchHostedWebSearchTool, HostedWebFetchTool, HostedFileSearchTool; also hosted code execution where supported
Similarity searchSimilaritySearch::usingModel(...)SimilaritySearch.UsingModel<T>(...), .UsingTable(...), or a custom search function
Database vector searchwhereVectorSimilarTo(...) with pgvectorWhereVectorSimilarTo(...), vector distance selection/ordering, pgvector columns/indexes
MiddlewareAgent prompt middlewareMiddleware() with DelegatingChatClient wrappers
StreamingStreamed responses and Vercel data protocolStream(...), UsingVercelDataProtocol(), UsingAgentUserInteractionProtocol()
ImagesImage::of(...)->generate()Image.Of(...).Generate(), including reference-image edits
Audio and transcriptionSpeech generation and transcriptionAudio.Of(...), Transcription.FromStorage(...), speaker diarization
Embeddings and rerankingEmbeddings, caching, rerankingEmbeddings.For(...), .Cache(...), multimodal inputs, Reranking.Of(...)
Files and vector storesUploaded documents and hosted retrieval storesFiles.Document.FromPath(...).Put(), Stores.Create(...), metadata-filtered search
Queue and broadcastQueue/broadcast agent responsesQueue(...), BroadcastOnQueue(...), QueueStructured<T>(...), QueueClassify(...)
Completion callbacksthen(...) / catch(...)Stream callbacks; serializable queue handler classes with Then<THandler>() / Catch<THandler>()
Lifecycle eventsPrompt, tool, and generation eventsEvent.Listen<AgentPrompted>(...), tool events, generation events
FakesAgent and generation fakesSalesCoach.Fake(...), per-feature fakes, prompt/generation assertions
Generatorsmake:agent, make:tooldotblaze make:agent, dotblaze make:tool

Additional capabilities documented in DotBlaze include estimated context-token budgets with optional summarization, provider-specific reasoning controls, and OpenAI remote history/background polling and stream resumption through Ai.Chat(). These do not imply identical Laravel APIs. Queue callbacks use handler classes rather than serialized closures; classification probabilities are model estimates, not calibrated confidence. The planned MCP server package is separate from the external MCP tools already usable by agents.

Only in DotBlaze ​

FeatureLaravelDotBlaze
Schema CheckNot built indotblaze db:check compares models with the database
Static TypingNot built inRoutes, controllers, and models are checked by the C# compiler

Complete Translation Example ​

For the complete model, request, policy, route, and view behind a controller action, follow the blog walkthrough. This is its update operation:

csharp
// Method in Blog.Controllers.PostController from the walkthrough.
public async Task<IActionResult> Update(Post post, PostRequest request)
{
    await Authorize("update", post);
    await post.Update(new { request.Title, request.Body });
    return RedirectRoute("posts.show", new { post = post.Id })
        .With("status", "Post updated.");
}
Laravel conceptWhat to implement in this example
Route model binding{post} and Post post must have matching names.
Form requestA typed PostRequest : FormRequest<PostRequest> with Rules.
$fillable[Fillable] on Title and Body.
PolicyPostPolicy : Policy<Post> with Update(User, Post).
redirect()->route()->with()RedirectRoute(...).With(...).
@csrf and @method('PUT')The same directives in Blade; @Csrf() and @Method("PUT") in Razor.

Compile-time types replace PHP's dynamic properties; Task methods must be awaited. The walkthrough's test checks both the successful update and a different user's forbidden update, so copying the syntax also preserves the authorization behavior.