PHPackages                             irongate/integrationchief - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. irongate/integrationchief

Abandoned → [irongate/chief](/?search=irongate%2Fchief)Library[Utility &amp; Helpers](/categories/utility)

irongate/integrationchief
=========================

Base functionality and helpers used for building for Chief Tools.

v0.34.1(3y ago)78641MITPHPPHP ^8.1CI passing

Since Jan 13Pushed 1w ago2 watchersCompare

[ Source](https://github.com/irongate/chief)[ Packagist](https://packagist.org/packages/irongate/integrationchief)[ Docs](https://chief.app)[ RSS](/packages/irongate-integrationchief/feed)WikiDiscussions develop Synced today

READMEChangelogDependencies (16)Versions (150)Used By (0)

Chief Tools SDK
---------------

[](#chief-tools-sdk)

[![Total Downloads](https://camo.githubusercontent.com/fc658691a381e0b7f734e373b8cb1bedcae2e641f3932a623acb3f9b7e66b4a5/68747470733a2f2f706f7365722e707567782e6f72672f6368696566746f6f6c732f73646b2f646f776e6c6f616473)](https://packagist.org/packages/chieftools/sdk)[![Monthly Downloads](https://camo.githubusercontent.com/0af4e95e2980c18483a0506720288951e03d690170550c9cb76a80e35627f826/68747470733a2f2f706f7365722e707567782e6f72672f6368696566746f6f6c732f73646b2f642f6d6f6e74686c79)](https://packagist.org/packages/chieftools/sdk)[![Latest Stable Version](https://camo.githubusercontent.com/204b757522a7754a6e4239809f206bf243c26e43831df882fd14580dda380375/68747470733a2f2f706f7365722e707567782e6f72672f6368696566746f6f6c732f73646b2f762f737461626c65)](https://packagist.org/packages/chieftools/sdk)[![License](https://camo.githubusercontent.com/f62209aee7d5606fc5aa849dab11b32f3dd0e33dff7c24aaac02d71c0e5c6e24/68747470733a2f2f706f7365722e707567782e6f72672f6368696566746f6f6c732f73646b2f6c6963656e7365)](https://packagist.org/packages/chieftools/sdk)

Base functionality and helpers used for building Chief Tools.

Keep in mind that this package is not meant to be used standalone, but as a base for building our own Chief Tools, this package is open-sourced for inspiration and to be used as a reference.

### Configures

[](#configures)

- Authentication through [Account Chief](https://account.chief.app/) (powered by [Socialite](https://laravel.com/docs/9.x/socialite))
- Configured [Sentry](https://docs.sentry.io/platforms/php/laravel/) client
- [Lighthouse GraphQL](https://lighthouse-php.com/) with base schema and scalars
    - Session protected endpoint `/api/graphql/web`
    - Session protected (GraphiQL) playground `/api/playground`
    - Access token protected endpoint `/api/graphql` (tokens managed by [Account Chief](https://account.chief.app/))
- Basic API documentation pages for GraphQL endpoint
- Account pages to show profile information and preferences
- Team pages to show team information, preferences and billing
- Redirects to Chief Tools for `/contact`, `/privacy`, `/terms`
- [Account Chief](https://account.chief.app/) webhook handler to be notified when user, team or tokens change
- Login event listener to update the `last_login` column on the `users` table
- Health check queue job pinging `QUEUE_MONITOR_URL` every minute using the default queue (disabled when `QUEUE_MONITOR_URL` is empty or unset)

### Provides

[](#provides)

#### Middleware

[](#middleware)

- `ChiefTools\SDK\Middleware\AuthenticateChief`
    Validates a request comes from [Chief Tools](https://chief.app/)
    Requires `services.chief.webhook_secret` configuration to be set to a random string
- `ChiefTools\SDK\Middleware\AutoAuthenticate`
    Uses both the `api` and `web` guard and sets the first that is authenticated
- `ChiefTools\SDK\Middleware\ForceSecure`
    Make sure the request is over `https://`
- `ChiefTools\SDK\Middleware\MoveAccessTokenFromURLToHeader`
    Move the access token from `access_token` GET paramater to the `Authorization` header
- `ChiefTools\SDK\Middleware\SecurityHeaders`
    Adds a default set of security headers, can be configured by setting `chief.response.securityheaders` (array) in the app config
- `ChiefTools\SDK\Middleware\TrustProxiesOnVapor`
    Configures `fideloper/proxy` to be used on [Laravel Vapor](https://vapor.laravel.com/)

#### Validation rules

[](#validation-rules)

- `ChiefTools\SDK\Rules\UUID`
    Valites the input value is a UUIDv4

#### Helpers

[](#helpers)

- `active($whitelist = null, $blacklist = null, $active = 'active', $inactive = '')`
    Get active state based on whitelist. Used to indicate active menu's
- `timezones(): array`
    Return an key-value list of all timezones
- `validate($fields, $rules): bool`
    Validate fields against rules. Example `validate($id, new \ChiefTools\SDK\Rules\UUID)`
- `latest_ca_bundle_file_path(): string`
    Get the path to the most up-to-date CA bundle file, uses [Certainty](https://github.com/paragonie/certainty) under the hood

### Installation

[](#installation)

Start with requiring the package:

```
composer require chieftools/sdk
```

Publish the configuration files and optionally the migrations:

```
php artisan vendor:publish --tag=chief-config

# php artisan vendor:publish --tag=chief-migrations
```

Run the app migrations to create the users table:

```
php artisan migrate
```

Add the Chief service to the `config/services.php`:

```
