Code Monkey home page Code Monkey logo

oktasdk-php's Introduction

OktaSDK-PHP

!!! 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 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

  1. Fork the repository

  2. Clone your fork:

    git clone [email protected]:your-username/oktasdk-php.git
    # 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.

Copyright

This project is liscensed under the MIT License.

oktasdk-php's People

Contributors

phlak avatar ironiclensflare avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.