Skip to content

Migrating from Laravel

Tyravel borrows Laravel's mental model — routes, middleware, Eloquent-style models, queues, and Blade-like views — while targeting TypeScript and Node.js 26+ (or Bun). This guide maps familiar Laravel concepts to Tyravel equivalents.

Application bootstrap

LaravelTyravel
bootstrap/app.phpsrc/main.ts + src/providers/app-service-provider.ts
config/*.phpconfig/*.ts with typed env() and optional schema
.env.env (same idea; validated on boot)
php artisan servetyravel dev or tyravel serve
php artisantyravel CLI (migrate, make:*, queue:work, …)

Routing

LaravelTyravel
routes/web.phpsrc/routes/web.ts
Route::get('/', …)Route.get('/', …) from @tyravel/core
Route model bindingrequest.routeModel('post')
php artisan route:listtyravel route:list
php artisan route:cachetyravel route:cache

Controllers are TypeScript classes with async methods. Invokable controllers use __invoke.

Views

LaravelTyravel
Blade (.blade.php)Tyr templates (.tyr)
@extends, @section@layout, @section, @yield
<x-alert /> components@component('alert')
Livewire / islands@island + client registerIsland()
Programmatic UI.tyr.ts views with render() / mount()

Run tyravel view:types for typed props (ViewPropsMap). Lint with tyravel view:lint --strict.

Eloquent → models

LaravelTyravel
User::find(1)await User.find(1)
$user->posts()user.posts() relation helpers
Migrationsdatabase/migrations/*.ts + tyravel migrate
Factories / seederstyravel make:factory, tyravel db:seed
Soft deletesSoftDeletes trait on models

Models live in src/models/ and extend Model from @tyravel/database.

Auth

LaravelTyravel
php artisan install:api / Breezetyravel auth:install
SocialiteBuilt-in OAuth drivers in @tyravel/auth
Auth::user()Auth.user() facade
Gates / policiesGate + policy classes

Queues & events

LaravelTyravel
ShouldQueue listenersQueue-backed listeners via @tyravel/queue
php artisan queue:worktyravel queue:work or tyravel dev --queue
event() / Event::dispatchEvents.dispatch()
Bus::dispatchBus.dispatch() with auto-resolved handlers

Register explicit handlers with Bus.register(Command, Handler) when you prefer explicit wiring over convention.

Mail & notifications

LaravelTyravel
Mailable classesClasses implementing mail contracts in @tyravel/mail
php artisan make:notificationtyravel make:notification (via notifications package)
MAIL_MAILER=logSame env key; log driver for local dev

Testing

LaravelTyravel
PHPUnit / PestVitest + @tyravel/testing
php artisan testtyravel test
$this->get('/')test.http.get('/') with assertion helpers
actingAs($user)test.http.actingAs(user)

See Testing for HTTP recipes, queue draining, and parallel Vitest workspaces.

Deployment

LaravelTyravel
php artisan config:cachetyravel config:cache / config:clear
php artisan view:cachetyravel view:cache
Forge / Vapor patternsdeploy/ scaffold (Docker, Fly, Railway)
Health checks/health/live and /health/ready

Run tyravel deploy:check before shipping to validate doctor checks, route compilation, and view cache.

Debugging

LaravelTyravel
Telescope (paid/complex)tyravel debug:install + debug bar
Query logDebug bar query count + N+1 warnings
php artisan tinkertyravel shell (.routes, .models, persistent history)

Suggested first steps

  1. npm create tyravel@latest or tyravel new my-app --template=saas
  2. tyravel migrate and tyravel dev
  3. Port routes from routes/web.php to src/routes/web.ts
  4. Convert Blade layouts to .tyr and run tyravel view:lint
  5. Move models and migrations; run tyravel test

For a working reference app, see examples/hello-world and examples/saas-starter.

Released under the MIT License.