# Plain PHP Example

This example demonstrates the intended usage shape of `gnexus/auth-client` in a minimal non-framework PHP application.

It is not production-ready.

## What It Shows

- redirecting a user to `gnexus-auth`
- handling the authorization callback
- exchanging code for tokens
- fetching the current user
- verifying and parsing webhooks
- storing state, PKCE data and tokens in native PHP session

## Files

- `bootstrap.php` - package construction
- `stores.php` - session-backed example stores
- `index.php` - start authorization flow
- `callback.php` - handle authorization callback
- `webhook.php` - verify and parse webhook request

## Requirements

The example assumes you install compatible PSR implementations in the real package repository, for example:

- PSR-18 HTTP client
- PSR-17 request factory
- PSR-17 stream factory

The example code uses placeholders for these objects. Wire them with the implementations your project uses.

## Runtime Notes

- call `session_start()` before using the example stores;
- do not use the session stores as-is for distributed production systems;
- use persistent shared storage if your application runs on multiple nodes.

## Related Example

If you need a minimal `composer.json` for a consuming service, see:

- `../consumer-template`
