Download the PHP package pubpackage/okta-sdk-php without Composer
On this page you can find all versions of the php package pubpackage/okta-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pubpackage/okta-sdk-php
More information about pubpackage/okta-sdk-php
Files in pubpackage/okta-sdk-php
Package okta-sdk-php
Short Description PHP Wrapper for the Okta API
License Apache-2.0
Informations about the package okta-sdk-php
Okta PHP SDK
Installation
okta-sdk-php is available on Packagist as the okta/sdk package.
Run composer require okta/sdk
from the root of your project in terminal, and you are done.
Client Initialization
Once you have the SDK installed in your project, you will need to instantiate a Client object. We follow the builder pattern for building a Client. You can create a Client by calling the ClientBuilder and relying on the ~/.okta/okta .yaml file for the settings
By default, The client builder will look for a file in your home directory with the Okta properties you want to use.
This file should be placed at ~/.okta/okta.yaml
. If at this location, you do not need to define the location
during initialization. If you are unable to place the file there, or you are on a Windows based machine, you will
have to define the location of this file manually if you want to use the file.
If you need to override any of the defaults from your ~/.okta/okta.yaml
file, or you do not have one, you can set
the properties on the client builder directly. The minimum required properties are your token and organization url.
Changing your Http Client Instance
The Okta PHP SDK follows PSR-7 standards for HTTP Messages. We are using Httplug which allows you to change out to
any PSR-7 compliant Http Client. Create a new instance of a Http\Client\HttpClient
implementation and pass it into the client builder.
OAuth 2.0
Okta allows you to interact with Okta APIs using scoped OAuth 2.0 access tokens. Each access token enables the bearer to perform specific actions on specific Okta endpoints, with that ability controlled by which scopes the access token contains.
This SDK supports this feature only for service-to-service applications. Check out our guides to learn more about how to register a new service application using a private and public key pair.
When using this approach you won't need an API Token because the SDK will request an access token for you. In order to use OAuth 2.0, construct a client instance by passing the following parameters:
Users
Finding a user by id
Finding a user by email
Creating a User
Update user profile
Our SDK allows you to fill in the default profile fields, as well as other dynamic fields that you create in your profile.
Pagination and Collections
All of our calls that return a set of items will return a Collection object. The collection object we built on top of is the tightenco/collect object.
Getting all users
Narrowing Responses
To start at the second entry and get the next two items:
Caching
The Okta PHP SDK allows any resource with a self link to be cached by default. The SDK uses any PSR-6
caching adaptor that you would like to use. By default, we ship with the
filesystem cache pool with the
flysystem memory adaptor. By doing this, there is no
need to configure anything, however, if you would like to run with your own Cache strategy, or change how
the default works, you are able to swap out the Cache Manager. Create a new Cache Manager that extends the
base \Okta\Cache\CacheManager
class, and call the parent setCachePool()
method. This should be called
with an instance of a PSR-6 compliant cache pool implementation. Once created, you can swap out the manager
using the ClientBuilder
class
Contents of the okta.yaml File
When you use OAuth 2.0 the full YAML configuration looks like:
You can pass the path to your private key pem file as well instead of copying the pem string into the YAML configuration E.g
PrivateKey: /Path/to/privateKey.pem
For information on what can go into the query property, visit our documentation
All versions of okta-sdk-php with dependencies
psr/http-message Version ^1.0
php-http/client-common Version ^1.6
php-http/httplug Version ^1.1
php-http/message Version ^1.5
php-http/discovery Version ^1.2
php-http/curl-client Version ^1.7
symfony/yaml Version ^3.2|^4.3|^5.2
nesbot/carbon Version ^2.0
guzzlehttp/psr7 Version ^1.4
psr/cache Version ^1.0
league/flysystem-memory Version ^1.0
cache/filesystem-adapter Version ^1.0
lcobucci/jwt Version ^4.0@alpha
illuminate/collections Version ^8.0