Installation and setup | laravel-query-builder-go | Spatie       

 SPATIE  

laravel-query-builder-go
========================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-query-builder-go](https://spatie.be/docs/laravel-query-builder-go/v1)  Installation and setup

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-query-builder-go/v1) 

  Installation and setup    
- [ Requirements ](https://spatie.be/docs/laravel-query-builder-go/v1/requirements)
- [ Introduction ](https://spatie.be/docs/laravel-query-builder-go/v1/introduction)
- [ Installation and setup ](https://spatie.be/docs/laravel-query-builder-go/v1/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-query-builder-go/v1/questions-issues)
- [ Testing ](https://spatie.be/docs/laravel-query-builder-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/laravel-query-builder-go/v1/releasing)
- [ Changelog ](https://spatie.be/docs/laravel-query-builder-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/laravel-query-builder-go/v1/support-us)
- [ About us ](https://spatie.be/docs/laravel-query-builder-go/v1/about-us)

Features
--------

- [ Filtering ](https://spatie.be/docs/laravel-query-builder-go/v1/features/filtering)
- [ Sorting ](https://spatie.be/docs/laravel-query-builder-go/v1/features/sorting)
- [ Including relationships ](https://spatie.be/docs/laravel-query-builder-go/v1/features/including-relationships)
- [ Selecting fields ](https://spatie.be/docs/laravel-query-builder-go/v1/features/selecting-fields)

Advanced usage
--------------

- [ Extending query builder ](https://spatie.be/docs/laravel-query-builder-go/v1/advanced-usage/extending-query-builder)
- [ Pagination ](https://spatie.be/docs/laravel-query-builder-go/v1/advanced-usage/pagination)
- [ Multi value delimiter ](https://spatie.be/docs/laravel-query-builder-go/v1/advanced-usage/multi-value-delimiter)
- [ Front-end implementation ](https://spatie.be/docs/laravel-query-builder-go/v1/advanced-usage/front-end-implementation)
- [ Differences from PHP ](https://spatie.be/docs/laravel-query-builder-go/v1/advanced-usage/port-differences)

 Installation and setup
======================

###  On this page 

1. [ Configuration ](#content-configuration)

You can install the package with Go:

```
go get github.com/spatie/laravel-query-builder-go@v0.1.0
```

Add the package to your application's `bootstrap/app.go`:

```
import (
    "github.com/spatie/laravel-query-builder-go"
    laravel "go.laravel.com"
)

func Options() laravel.Options {
    return laravel.Options{
        Packages: []laravel.Package{
            querybuilder.New(func(c *querybuilder.Config) {
                c.Delimiter = "|"
            }),
        },
    }
}
```

Installing the Go module alone does not activate the package. No config publishing or Composer discovery is needed. Registration uses Laravel's native registrar. It is safe to reuse one package across isolated applications.

Configuration
-----------------------------------------------------------------------------------------------

Start from `DefaultConfig()` outside an application. In a handler, use the app's settings explicitly:

```
query := querybuilder.For(model.Query[User](), input).Config(querybuilder.From(r))
```

Callbacks passed to `New` run after environment values. Invalid boolean environment values stop application startup. Settings belong to the application, not process-global variables.

SettingEnvironment variableDefault`Parameters.Filter``QUERY_BUILDER_FILTER_PARAMETER``filter``Parameters.Sort``QUERY_BUILDER_SORT_PARAMETER``sort``Parameters.Include``QUERY_BUILDER_INCLUDE_PARAMETER``include``Parameters.Fields``QUERY_BUILDER_FIELDS_PARAMETER``fields``Parameters.Append``QUERY_BUILDER_APPEND_PARAMETER``append``Delimiter``QUERY_BUILDER_DELIMITER``,``SplitFilterValues``QUERY_BUILDER_SPLIT_FILTER_VALUES``true``IgnoreUnknownFilters``QUERY_BUILDER_IGNORE_UNKNOWN_FILTERS``false``IgnoreUnknownSorts``QUERY_BUILDER_IGNORE_UNKNOWN_SORTS``false``IgnoreUnknownIncludes``QUERY_BUILDER_IGNORE_UNKNOWN_INCLUDES``false``SnakeCaseFields``QUERY_BUILDER_SNAKE_CASE_FIELDS``false``CountSuffix``QUERY_BUILDER_COUNT_SUFFIX``Count``ExistsSuffix``QUERY_BUILDER_EXISTS_SUFFIX``Exists`Set `Parameters.Filter` to an empty string for top-level filters. Every top-level parameter then participates in the filter allowlist. Set a suffix to empty to disable its generated convenience includes. Explicit include names and callbacks remain available.

`FromRequest` reads only query input. For a decoded JSON body, use `RequestData(map[string]any{...})` explicitly. Query parameters are not implicitly merged with body input. Duplicate scalar keys keep the last value. When conflicting bracket shapes are supplied, keys are applied in sorted order. Nesting is limited to 32 components and indexes to 10,000.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
