An example PHP app demonstrating Admin Portal with the WorkOS PHP SDK.
Composer - Link
-
Clone the repo and install the dependencies by running the following:
git clone [email protected]:workos/php-example-applications cd php-example-applications/php-admin-portal-example composer i
-
Follow the instructions here on setting up an Admin Portal session.
-
Create a new file called
.envand enter your API Key and Client ID from the WorkOS Dashboard.
WORKOS_API_KEY="your_api_key"
WORKOS_CLIENT_ID="your_client_id"
Use the following command to run the app:
php -S localhost:8000 router.phpOnce running, you'll be prompted for an Organization Name, a space separated list of domains associated with that domain, and if you'd like to launch the SSO or Directory Sync Admin Portal flow.
The app logic will check if there is a matching Organization already based on the domains entered and if not it will create a new one. Simply plug this in and you'll be redirected to a live admin portal session for that organization.