This package is abandoned and no longer maintained. The author suggests using the okta/sdk package instead.

PHP client library for the Okta API (v1)

1.2.12 2018-05-11 15:10 UTC


!!! UNMAINTAINED !!! - This library is no longer maintained. You are recommend to switch to the official okta/sdk library instead.

Latest Stable Version Total Downloads License Build Status

PHP client library for the Okta API (v1)

Refer to the full Okta API documentation for more complete information on each resource/component.

Install with Composer

composer require iodatacenters/oktasdk

Initializing the Client

To initialize the client object you must pass in your Okta organization subdomain and API key as parameters. For example, if your Okta domain is, your org prefix is foo. For instructions on how to get an API key for your organization, see Obtaining a token.


use Okta;

$okta = new Okta\Client('foo', 'api_key');

You may also optionally pass an array of config options as the third argument:

$okta = new Okta\Client('foo', 'api_key', [
    'bootstrap' => false, // Don't auto-bootstrap the Okta resource properties
    'preview'   => true,  // Use the okta preview ( domain
    'headers'   => [
        'Some-Header'    => 'Some value',
        'Another-Header' => 'Another value'


All Okta resources are available via the $okta->$resource->$method syntax where $resource is the lower case, singular name of the resource (i.e. - Users = user, Groups = group, etc.) and $method is the method name (see the docs for all available methods). The only exception being the Authentication resource for which the method name is auth (because authentication is just too long).


// Get a user by ID
$user = $okta->user->get('jpinkerton');

// Add user to a group
$group = $okta->group->addUser($someGroupId, $user->id);

// Get a user's apps
$userApps = $okta->user->apps($user->id);

Handling Exceptions

use Okta;

try {
    $user = $okta->user->get('jpinkerton');
} catch (Okta\Exception as $e) {
    return $e->getErrorSummary();

See documentation for available exception methods.


  1. Fork the repository

  2. Clone your fork:

    git clone
    # NOTE: Be sure to use your fork's repository URL
  3. In your local copy, create a branch:

    git checkout -b descriptive-branch-name'
  4. Make your changes

  5. Commit your changes:

    git commit -m "Your commit notes here"
    # NOTE: Be descriptive with your commit notes
  6. Push your branch:

    git push origin descriptive-branch-name
  7. Open a Pull Request on GitHub.


This project is liscensed under the MIT License.