This is a directory standard, but you can change it if you like.
Directory | Action |
---|---|
commands | Store the command files |
config | Store the config files |
contracts | Store the contract files |
facades | Store the facade files |
root | Store the service provider and package source code |
- Add package
go get -u github.com/goravel/example-package
- Register service provider
// config/app.go
import examplepackage "github.com/goravel/example-package"
"providers": []foundation.ServiceProvider{
...
&examplepackage.ServiceProvider{},
}
- Publish Configuration
go run . artisan vendor:publish --package=github.com/goravel/example-package
- Testing
// main.go
import examplefacades "github.com/goravel/example-package/facades"
fmt.Println(examplefacades.Hello().World())
The console will print Welcome To Goravel Package
.