Compare With Laravel
Goravel is heavily inspired by the Laravel framework, aiming to bring similar elegance and simplicity to Go developers. Here are some key comparisons between Goravel and Laravel to help you understand how Goravel aligns with Laravel's features:
| Feature | Goravel | Laravel | Code Example |
|---|---|---|---|
| Artisan Console | ✅ | ✅ | ./artisan key:generate php artisan key:generate |
| Authentication | ✅ | ✅ | facades.Auth(ctx).Login(&user) Auth::login($user) |
| Authorization | ✅ | ✅ | facades.Gate().Allows("update", user) Gate::allows('update', $user) |
| Cache | ✅ | ✅ | facades.Cache().Put("key", "value", time.Minute) Cache::put('key', 'value', 60) |
| Carbon | ✅ | ✅ | carbon.Now().AddDays(1) Carbon::now()->addDays(1) |
| Config | ✅ | ✅ | facades.Config().GetString("app.name") config('app.name') |
| Crypt | ✅ | ✅ | facades.Crypt().EncryptString("text") Crypt::encryptString('text') |
| DB | ✅ | ✅ | facades.DB().Table("users").Get(&users) DB::table('users')->get() |
| Event | ✅ | ✅ | facades.Event().Job(&events.Order{}).Dispatch() Order::dispatch() |
| Factory | ✅ | ✅ | facades.Orm().Factory().Make(&user) User::factory()->make() |
| FileStorage | ✅ | ✅ | facades.Storage().Put("file.txt", "content") Storage::put('file.txt', 'content') |
| Hash | ✅ | ✅ | facades.Hash().Make("password") Hash::make('password') |
| Http | ✅ | ✅ | facades.Route().Get("/", controller.Index) Route::get('/', [Controller::class, 'index']) |
| Http Client | ✅ | ✅ | facades.Http().Get("https://api.com") Http::get('https://api.com') |
| Localization | ✅ | ✅ | facades.Lang(ctx).Get("messages.welcome") __('messages.welcome') |
| Logger | ✅ | ✅ | facades.Log().Info("message") Log::info('message') |
| ✅ | ✅ | facades.Mail().To("user@example.com").Send() Mail::to('user@example.com')->send(new Order()) | |
| Mock | ✅ | ✅ | |
| Migrate | ✅ | ✅ | ./artisan migrate php artisan migrate |
| Orm | ✅ | ✅ | facades.Orm().Query().Find(&user, 1) User::find(1) |
| Package Development | ✅ | ✅ | |
| Process | ✅ | ✅ | facades.Process().Run("ls", "-la") `Process::run('ls -la') |
| Queue | ✅ | ✅ | facades.Queue().Job(&jobs.Process{}).Dispatch() Process::dispatch() |
| Rate Limiting | ✅ | ✅ | facades.RateLimiter().For("global", ...) RateLimiter::for('global', ...) |
| Seeder | ✅ | ✅ | facades.Seeder().Call([]seeder.Seeder{&User{}}) $this->call([User::class]) |
| Session | ✅ | ✅ | ctx.Request().Session().Put("key", "value") session(['key' => 'value']) |
| Task Scheduling | ✅ | ✅ | facades.Schedule().Command("emails:send").Daily() Schedule::command('emails:send')->daily() |
| Testing | ✅ | ✅ | |
| Validation | ✅ | ✅ | ctx.Request().ValidateRequest() $request->validate() |
| View | ✅ | ✅ | ctx.Response().View().Make("welcome.tmpl") view('welcome') |
| Grpc | ✅ | 🚧 | |
| Notifications | 🚧 | ✅ | |
| Broadcasting | 🚧 | ✅ | |
| Livewire | 🚧 | ✅ |
