An example PHP app demonstrating SSO with the WorkOS PHP SDK.
Composer - Link
-
Clone the repo and install the dependencies by running the following:
git clone git@github.com:workos/php-example-applications cd php-example-applications/php-directory-sync-example composer i -
Follow the instructions here on setting up an SSO connection. The redirect URL for the example app if used as is will be http://localhost:8000/auth/callback.
-
Create a file at the root of this project called .env and declare the WorkOS API Key, WorkOS Client ID, and Webhooks Secret.
WORKOS_CLIENT_ID="your_client_id"
WORKOS_WEBHOOKS_SECRET="your_webhook_secret"
Use the following command to run the app:
php -S localhost:8000 router.phpOnce running, navigate to the following URL for a demonstration on the SSO workflow: http://localhost:8000.
- WorkOS sends Webhooks as a way of managing updates to Directory Sync connections. The Webhooks section of the WorkOS Dashboard allows you to send test webhooks to your application. The Test Webhooks section of this application allows you to visualize the validated webhooks directly in this application in real-time. Please review the tutorial here for details on how this can be done locally. The Webhooks secret variable, for which the value can be obtained in the WorkOS dashboard, must be filled out on
variables.phpto use this feature.