chieftools/sdk
| Install | |
|---|---|
composer require chieftools/sdk |
|
| Latest Version: | v0.119.0 |
| PHP: | ^8.4 |
| License: | MIT |
| Last Updated: | Sep 15, 2026 |
| Links: | GitHub · Packagist |
Chief Tools 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
- Authentication through Account Chief (powered by Socialite)
- Configured Sentry client
- Lighthouse GraphQL 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)
- Session protected endpoint
- 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 webhook handler to be notified when user, team or tokens change
- Login event listener to update the
last_logincolumn on theuserstable - Health check queue job pinging
QUEUE_MONITOR_URLevery minute using the default queue (disabled whenQUEUE_MONITOR_URLis empty or unset)
Provides
Middleware
ChiefTools\SDK\Middleware\AuthenticateChiefValidates a request comes from Chief Tools Requiresservices.chief.webhook_secretconfiguration to be set to a random stringChiefTools\SDK\Middleware\AutoAuthenticateUses both theapiandwebguard and sets the first that is authenticatedChiefTools\SDK\Middleware\ForceSecureMake sure the request is overhttps://ChiefTools\SDK\Middleware\MoveAccessTokenFromURLToHeaderMove the access token fromaccess_tokenGET paramater to theAuthorizationheaderChiefTools\SDK\Middleware\SecurityHeadersAdds a default set of security headers, can be configured by settingchief.response.securityheaders(array) in the app configChiefTools\SDK\Middleware\TrustProxiesOnVaporConfiguresfideloper/proxyto be used on Laravel Vapor
Validation rules
ChiefTools\SDK\Rules\UUIDValites the input value is a UUIDv4
Helpers
active($whitelist = null, $blacklist = null, $active = 'active', $inactive = '')Get active state based on whitelist. Used to indicate active menu'stimezones(): arrayReturn an key-value list of all timezonesvalidate($fields, $rules): boolValidate fields against rules. Examplevalidate($id, new \ChiefTools\SDK\Rules\UUID)latest_ca_bundle_file_path(): stringGet the path to the most up-to-date CA bundle file, uses Certainty under the hood
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:
<?php
return [
'chief' => [
'client_id' => env('CHIEF_CLIENT_ID'),
'client_secret' => env('CHIEF_CLIENT_SECRET'),
'webhook_secret' => env('CHIEF_SECRET'),
'base_url' => env('CHIEF_BASE_URL', 'https://account.chief.app'),
'verify' => env('CHIEF_VERIFY', true),
'redirect' => '/login/callback',
],
];
That's all, you should be able to authenticate against Account Chief.
GraphQL API
You will need to create a routes/graphql/schema.graphql in your own project with the following contents:
#import ../../vendor/chieftools/sdk/routes/graphql/schema.graphql
Anything you want to add the the schema you can do thereafter, for example:
#import ../../vendor/chieftools/sdk/routes/graphql/schema.graphql
#import ./types/*.graphql
#import ./queries/*.graphql
Keep in mind that the User type is already provided so you will need to extend that if you want to append fields.
type OfType implements Entity {
id: ID!
}
extend type User {
relation: [OfType!]! @hasMany(type: "paginator")
}
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.