Download the PHP package nickmoline/stytch-php without Composer
On this page you can find all versions of the php package nickmoline/stytch-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package stytch-php
Stytch PHP Library
Unofficial PHP SDK for Stytch based on the Official Stytch Node.js Library.
Installation
Requirements
- PHP 8.2 or higher
- Guzzle HTTP Client
- PSR-7 compatible HTTP messages
Usage
You can find your API credentials in the Stytch Dashboard.
Basic Setup
B2B Features
This library currently supports the following B2B features:
- [x] Organizations
- [x] Magic Links
- [x] Sessions
- [x] Discovery
- [x] Impersonation
- [x] OAuth
- [x] OTPs (SMS & Email)
- [x] Passwords
- [x] RBAC
- [x] Recovery Codes
- [x] SCIM
- [x] SSO
- [x] TOTPs
- [x] IDP
B2C Features
This library currently supports the following B2C features:
- [x] Users
- [x] Magic Links (Email)
- [x] Sessions
- [x] OAuth
- [x] OTPs (SMS, Email, WhatsApp)
- [x] Passwords
- [x] TOTPs
- [x] WebAuthn
- [x] Crypto Wallets
- [x] Fraud Detection
- [x] Project Management
- [x] Impersonation
- [x] IDP
- [x] M2M
- [x] Attributes
Object-Based Responses
The library returns proper PHP objects instead of raw arrays, providing better type safety and IDE support. All responses include a request_id
and status_code
for debugging purposes.
Note: B2B responses return structured objects, while B2C responses return arrays. This difference reflects the underlying API structure.
Carbon Date Handling
All date and time fields from the Stytch API are automatically converted to Carbon instances, providing rich date manipulation capabilities:
Available Carbon date fields:
created_at
- When the resource was createdupdated_at
- When the resource was last updatedexpires_at
- When a session or token expiresstarted_at
- When a session startedlast_accessed_at
- When a session was last accessedlock_created_at
- When a user/member lock was createdlock_expires_at
- When a user/member lock expireslast_authenticated_at
- When authentication factor was last usedbearer_token_expires_at
- When a bearer token expires
Implementation Details:
The library uses a HasCarbonDates
trait to handle date parsing consistently across all object classes. This trait provides:
parseDate(?string $date): ?Carbon
- Safely parse date strings to Carbon instancesparseDates(array $dates): array
- Parse multiple date strings at oncetoDateString(?Carbon $date): ?string
- Convert Carbon instances back to ISO stringstoDateStrings(array $dates): array
- Convert multiple Carbon instances at once
This approach ensures consistent date handling and reduces code duplication throughout the library.
B2B Response Format (Object-based)
B2C Response Format (Array-based)
B2B Examples
Create an Organization
Get an Organization
Update an Organization
Delete an Organization
Search Organizations
Send Magic Link for Login/Signup
Authenticate Magic Link
Authenticate Session
Get Session
Revoke Session
Password Authentication
Password Strength Check
OAuth Authentication
Send SMS OTP
Authenticate SMS OTP
Send Email OTP
Authenticate Email OTP
Create TOTP
Authenticate TOTP
Get Recovery Codes
Recover with Recovery Code
Discovery - List Organizations
Discovery - Create Organization
Discovery - Get Organization
Discovery - Update Organization
Discovery - Delete Organization
SSO Authentication
Get SSO Connections
Delete SSO Connection
SCIM Connection Management
IDP Token Introspection
IDP - Get Token
Impersonation - Authenticate
RBAC Policy
All versions of stytch-php with dependencies
ext-json Version *
ext-curl Version *
guzzlehttp/psr7 Version ^2.7
guzzlehttp/guzzle Version ^7.0
nesbot/carbon Version ^3.0