Laravel bilan solishtiring
Goravel asosan Laravel frameworkidan ilhomlanib, Go dasturchilariga shunga o'xshash nafislik va soddalikni olib kelishni maqsad qiladi. Goravelning Laravel xususiyatlari bilan qanday mos kelishini tushunishingizga yordam berish uchun Goravel va Laravel o'rtasidagi ba'zi asosiy taqqoslashlar:
| Xususiyat | Goravel | Laravel | Kod misoli |
|---|---|---|---|
| Artisan Console | ✅ | ✅ | ./artisan key:generate php artisan key:generate |
| Autentifikatsiya | ✅ | ✅ | facades.Auth(ctx).Login(&user) Auth::login($user) |
| Avtorizatsiya | ✅ | ✅ | facades.Gate().Allows("update", user) Gate::allows('update', $user) |
| Kesh | ✅ | ✅ | facades.Cache().Put("key", "value", time.Minute) Cache::put('key', 'value', 60) |
| Carbon | ✅ | ✅ | carbon.Now().AddDays(1) Carbon::now()->addDays(1) |
| Konfiguratsiya | ✅ | ✅ | facades.Config().GetString("app.name") config('app.name') |
| Kriptlash | ✅ | ✅ | facades.Crypt().EncryptString("text") Crypt::encryptString('text') |
| MB | ✅ | ✅ | facades.DB().Table("users").Get(&users) DB::table('users')->get() |
| Hodisa | ✅ | ✅ | facades.Event().Job(&events.Order{}).Dispatch() Order::dispatch() |
| Fabrika | ✅ | ✅ | facades.Orm().Factory().Make(&user) User::factory()->make() |
| Fayl Tizimi | ✅ | ✅ | facades.Storage().Put("file.txt", "content") Storage::put('file.txt', 'content') |
| Hashlash | ✅ | ✅ | facades.Hash().Make("password") Hash::make('password') |
| HTTP | ✅ | ✅ | facades.Route().Get("/", controller.Index) Route::get('/', [Controller::class, 'index']) |
| HTTP Klienti | ✅ | ✅ | facades.Http().Get("https://api.com") Http::get('https://api.com') |
| Lokalizatsiya | ✅ | ✅ | facades.Lang(ctx).Get("messages.welcome") __('messages.welcome') |
| Log Yozuvchi | ✅ | ✅ | facades.Log().Info("message") Log::info('message') |
| Pochta | ✅ | ✅ | facades.Mail().To("user@example.com").Send() Mail::to('user@example.com')->send(new Order()) |
| Mocklash | ✅ | ✅ | |
| Migratsiya | ✅ | ✅ | ./artisan migrate php artisan migrate |
| ORM | ✅ | ✅ | facades.Orm().Query().Find(&user, 1) User::find(1) |
| Paketni Ishlab Chiqish | ✅ | ✅ | |
| Jarayon | ✅ | ✅ | facades.Process().Run("ls", "-la") `Process::run('ls -la') |
| Navbat | ✅ | ✅ | facades.Queue().Job(&jobs.Process{}).Dispatch() Process::dispatch() |
| Tezlikni Cheklash | ✅ | ✅ | facades.RateLimiter().For("global", ...) RateLimiter::for('global', ...) |
| Seeder | ✅ | ✅ | facades.Seeder().Call([]seeder.Seeder{&User{}}) $this->call([User::class]) |
| Sessiya | ✅ | ✅ | ctx.Request().Session().Put("key", "value") session(['key' => 'value']) |
| Vazifa rejalashtirish | ✅ | ✅ | facades.Schedule().Command("emails:send").Daily() Schedule::command('emails:send')->daily() |
| Testlash | ✅ | ✅ | |
| Tekshirish | ✅ | ✅ | ctx.Request().ValidateRequest() $request->validate() |
| Koʻrish | ✅ | ✅ | ctx.Response().View().Make("welcome.tmpl") view('welcome') |
| Grpc | ✅ | 🚧 | |
| Bildirishnomalar | 🚧 | ✅ | |
| Efirga uzatish | 🚧 | ✅ | |
| Livewire | 🚧 | ✅ |
