GoravelGoravel
Home
Video
  • English
  • 简体中文
GitHub
Home
Video
  • English
  • 简体中文
GitHub
  • Prologue

    • Upgrade Guide

      • Upgrading To v1.15 From v1.14
      • Upgrading To v1.14 From v1.13
      • History Upgrade
    • Contribution Guide
    • Excellent Extend Packages
  • Getting Started

    • Installation
    • Configuration
    • Directory Structure
    • Compile
  • Architecture Concepts

    • Request Lifecycle
    • Service Container
    • Service Providers
    • Facades
  • The Basics

    • Routing
    • HTTP Middleware
    • Controllers
    • Requests
    • Responses
    • Views
    • Grpc
    • Session
    • Validation
    • Logging
  • Digging Deeper

    • Artisan Console
    • Cache
    • Events
    • File Storage
    • Mail
    • Queues
    • Task Scheduling
    • Localization
    • Package Development
    • Color
    • Strings
    • Helpers
  • Security

    • Authentication
    • Authorization
    • Encryption
    • Hashing
  • ORM

    • Getting Started
    • Relationships
    • Migrations
    • Seeding
    • Factories
  • Testing

    • Getting Started
    • HTTP Tests
    • Mock

Facades

  • Introduction
  • How Facades Work
  • Facade Class Reference

Introduction

facades provide a "static" interface for the core functionality of the application and provide a more flexible, more elegant, and easy-to-test syntax.

All facades of Goravel are defined under github.com/goravel/framework/facades. We can easily use facades:

import "github.com/goravel/framework/facades"

facades.Route().Run(facades.Config().GetString("app.host"))

How Facades Work

facades are generally instantiated in the Register or Boot stage of each module ServerProvider.

func (config *ServiceProvider) Register() {
  app := Application{}
  facades.Config = app.Init()
}

If the facades use other facades, then instantiate them in the Boot phase of the ServerProvider:

func (database *ServiceProvider) Boot() {
  app := Application{}
  facades.DB = app.Init()
}

Facade Class Reference

FacadeDocument
AppContainer
ArtisanCommand Console
AuthAuthentication
CacheCache
ConfigConfiguration
CryptEncryption
EventEvent
GateAuthorization
GrpcGrpc
HashHashing
LogLog
MailMail
OrmORM
QueueQueue
RateLimiterRateLimiter
RouteRoute
SeederSeeder
ScheduleSchedule
StorageStorage
TestingTesting
ValidationValidation
Edit this page
Prev
Service Providers