dakkusingh / oktasdk
PHP client library for the Okta API (v1)
Installs: 94 991
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 6
Open Issues: 2
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: ^6.1
Requires (Dev)
- phpdocumentor/phpdocumentor: ^2.8
- phpunit/phpunit: ^4.8
This package is auto-updated.
Last update: 2024-11-19 10:43:07 UTC
README
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 dakkusingh/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
https://foo.okta.com
, your org prefix is foo
. For instructions on how to get
an API key for your organization, see
Obtaining a token.
Example:
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 (oktapreview.com) domain 'headers' => [ 'Some-Header' => 'Some value', 'Another-Header' => 'Another value' ] ]);
Usage
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).
Example:
// 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.
Contributing
-
Fork the repository
-
Clone your fork:
git clone git@github.com:your-username/oktasdk-php.git # NOTE: Be sure to use your fork's repository URL
-
In your local copy, create a branch:
git checkout -b descriptive-branch-name'
-
Make your changes
-
Commit your changes:
git commit -m "Your commit notes here" # NOTE: Be descriptive with your commit notes
-
Push your branch:
git push origin descriptive-branch-name
-
Open a Pull Request on GitHub.
Copyright
This project is liscensed under the MIT License.