chieftools / sdk
Base functionality and helpers used for building for Chief Tools.
Installs: 2 641
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: ^8.3
- guzzlehttp/guzzle: ^7.5
- laracasts/utilities: ^3.2
- laravel/framework: ^11.9
- laravel/helpers: ^1.5
- laravel/socialite: ^5.5
- mll-lab/graphql-php-scalars: ^6.1
- nuwave/lighthouse: ^6.47
- pusher/pusher-php-server: ^7.2
- sentry/sentry: ^4.3
- sentry/sentry-laravel: ^4.5
- stayallive/laravel-eloquent-observable: ^1.0
- stayallive/laravel-eloquent-uuid: ^1.0
- stayallive/random-tokens: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.54
- larastan/larastan: ^3.0
- laravel/passport: ^12
- orchestra/testbench: ^9.1
- stayallive/laravel-passport-memoized: ^1.0
Suggests
- laravel/passport: Passport is required when legacy OAuth personal access tokens are still in use.
- stayallive/laravel-passport-memoized: Memoizes Passport token validation to improve performance when using Laravel Passport.
- dev-develop
- v0.80.1
- v0.80.0
- v0.79.2
- v0.79.1
- v0.79.0
- v0.78.2
- v0.78.1
- v0.78.0
- v0.77.0
- v0.76.0
- v0.75.1
- v0.75.0
- v0.74.0
- v0.73.0
- v0.72.0
- v0.71.0
- v0.70.0
- v0.69.2
- v0.69.1
- v0.69.0
- v0.68.2
- v0.68.1
- v0.68.0
- v0.67.6
- v0.67.5
- v0.67.4
- v0.67.3
- v0.67.2
- v0.67.1
- v0.67.0
- v0.66.4
- v0.66.3
- v0.66.2
- v0.66.1
- v0.66.0
- v0.65.3
- v0.65.2
- v0.65.1
- v0.65.0
- v0.64.5
- v0.64.4
- v0.64.3
- v0.64.2
- v0.64.1
- v0.64.0
- v0.63.2
- v0.63.1
- v0.63.0
- v0.62.0
- v0.61.1
- v0.61.0
- v0.60.7
- v0.60.6
- v0.60.5
- v0.60.4
- v0.60.3
- v0.60.2
- v0.60.1
- v0.60.0
- v0.59.10
- v0.59.9
- v0.59.8
- v0.59.7
- v0.59.6
- v0.59.5
- v0.59.4
- v0.59.3
- v0.59.2
- v0.59.1
- v0.59.0
- v0.58.4
- v0.58.3
- v0.58.2
- v0.58.1
- v0.58.0
- v0.57.2
- v0.57.1
- v0.57.0
- v0.56.4
- v0.56.3
- v0.56.2
- v0.56.1
- v0.56.0
- v0.55.6
- v0.55.5
- v0.55.4
- v0.55.3
- v0.55.2
- v0.55.1
- v0.55.0
- v0.54.4
- v0.54.3
- v0.54.2
- v0.54.1
- v0.54.0
- v0.53.4
- v0.53.3
- v0.53.2
- v0.53.1
- v0.53.0
- v0.52.0
- v0.51.9
- v0.51.8
- v0.51.7
- v0.51.6
- v0.51.5
- v0.51.4
- v0.51.3
- v0.51.2
- v0.51.1
- v0.51.0
- v0.50.2
- v0.50.1
- v0.50.0
- v0.49.3
- v0.49.2
- v0.49.1
- v0.49.0
- v0.48.2
- v0.48.1
- v0.48.0
- v0.47.8
- v0.47.7
- v0.47.6
- v0.47.5
- v0.47.4
- v0.47.3
- v0.47.2
- v0.47.1
- v0.47.0
- v0.46.1
- v0.46.0
- v0.45.0
- v0.44.1
- v0.44.0
- v0.43.1
- v0.43.0
- v0.42.6
- v0.42.5
- v0.42.4
- v0.42.3
- v0.42.2
- v0.42.1
- v0.42.0
- v0.41.2
- v0.41.1
- v0.41.0
- v0.40.2
- v0.40.1
- v0.40.0
- v0.39.1
- v0.39.0
- v0.38.2
- v0.38.1
- v0.38.0
- v0.37.25
- v0.37.24
- v0.37.23
- v0.37.22
- v0.37.21
- v0.37.20
- v0.37.19
- v0.37.18
- v0.37.17
- v0.37.16
- v0.37.15
- v0.37.14
- v0.37.13
- v0.37.12
- v0.37.11
- v0.37.10
- v0.37.9
- v0.37.8
- v0.37.7
- v0.37.6
- v0.37.5
- v0.37.4
- v0.37.3
- v0.37.2
- v0.37.1
- v0.37.0
- v0.36.6
- v0.36.5
- v0.36.4
- v0.36.3
- v0.36.2
- v0.36.1
- v0.36.0
- v0.35.5
- v0.35.4
- v0.35.3
- v0.35.2
- v0.35.1
- v0.35.0
- v0.34.1
- v0.34.0
- v0.33.3
- v0.33.2
- v0.33.1
- v0.33.0
- v0.32.8
- v0.32.7
- v0.32.6
- v0.32.5
- v0.32.4
- v0.32.3
- v0.32.2
- v0.32.1
- v0.32.0
- v0.31.2
- v0.31.1
- v0.31.0
- v0.30.10
- v0.30.9
- v0.30.8
- v0.30.7
- v0.30.6
- v0.30.5
- v0.30.4
- v0.30.3
- v0.30.2
- v0.30.1
- v0.30.0
- v0.29.4
- v0.29.3
- v0.29.2
- v0.29.1
- v0.29.0
- v0.28.9
- v0.28.8
- v0.28.7
- v0.28.6
- v0.28.5
- v0.28.4
- v0.28.3
- v0.28.2
- v0.28.1
- v0.28.0
- v0.27.2
- v0.27.1
- v0.27.0
- v0.26.1
- v0.26.0
- v0.25.10
- v0.25.9
- v0.25.8
- v0.25.7
- v0.25.6
- v0.25.5
- v0.25.4
- v0.25.3
- v0.25.2
- v0.25.1
- v0.25.0
- v0.24.1
- v0.24.0
- v0.23.2
- v0.23.1
- v0.23.0
- v0.22.9
- v0.22.8
- v0.22.7
- v0.22.6
- v0.22.5
- v0.22.4
- v0.22.3
- v0.22.2
- v0.22.1
- v0.22.0
- v0.21.0
- v0.20.2
- v0.20.1
- v0.20.0
- v0.19.0
- v0.18.2
- v0.18.1
- v0.18.0
- v0.17.0
- v0.16.0
- v0.15.0
- v0.14.3
- v0.14.2
- v0.14.1
- v0.14.0
- v0.13.3
- v0.13.2
- v0.13.1
- v0.13.0
- v0.12.3
- v0.12.2
- v0.12.1
- v0.12.0
- v0.11.0
- v0.10.4
- v0.10.3
- v0.10.2
- v0.10.1
- v0.10.0
- v0.9.5
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.21
- v0.8.20
- v0.8.19
- v0.8.18
- v0.8.17
- v0.8.16
- v0.8.15
- v0.8.14
- v0.8.13
- v0.8.12
- v0.8.11
- v0.8.10
- v0.8.9
- v0.8.8
- v0.8.7
- v0.8.6
- v0.8.5
- v0.8.4
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.0
- v0.6.0
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.0
- dev-master
This package is auto-updated.
Last update: 2024-12-22 14:24:38 UTC
README
Base functionality and helpers used for building for Chief Tools.
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_login
column on theusers
table - Health check queue job pinging
QUEUE_MONITOR_URL
every minute using the default queue (disabled whenQUEUE_MONITOR_URL
is empty or unset)
Provides
Middleware
ChiefTools\SDK\Middleware\AuthenticateChief
Validates a request comes from Chief Tools
Requiresservices.chief.webhook_secret
configuration to be set to a random stringChiefTools\SDK\Middleware\AutoAuthenticate
Uses both theapi
andweb
guard and sets the first that is authenticatedChiefTools\SDK\Middleware\ForceSecure
Make sure the request is overhttps://
ChiefTools\SDK\Middleware\MoveAccessTokenFromURLToHeader
Move the access token fromaccess_token
GET paramater to theAuthorization
headerChiefTools\SDK\Middleware\SecurityHeaders
Adds a default set of security headers, can be configured by settingchief.response.securityheaders
(array) in the app configChiefTools\SDK\Middleware\TrustProxiesOnVapor
Configuresfideloper/proxy
to be used on Laravel Vapor
Validation rules
ChiefTools\SDK\Rules\UUID
Valites 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(): array
Return an key-value list of all timezonesvalidate($fields, $rules): bool
Validate fields against rules. Examplevalidate($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 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") }