[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/externals/balanced-php/src/Balanced/ -> APIKey.php (summary)

(no description)

File Size: 55 lines (1 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

APIKey:: (1 method):
  init()


Class: APIKey  - X-Ref

Represents an api key. These are used to authenticate you with the api.

Typically you create an initial api key:

<code>
print \Balanced\Settings::$api_key == null;
$api_key = new \Balanced\APIKey();
$api_key = api_key->save();
$secret = $api_key->secret;
print $secret;
</code>

Then save the returned secret (we don't store it) and configure the client
to use it:

<code>
\Balanced\Settings::$api_key = 'my-api-key-secret';
</code>

You can later add another api key if you'd like to rotate or expire old
ones:

<code>
$api_key = new \Balanced\APIKey();
$api_key = api_key->save();
$new_secret = $api_key->secret;
print $new_secret;

\Balanced\Settings::$api_key = $new_secret;

\Balanced\APIKey::query()
->sort(\Balanced\APIKey::f->created_at->desc())
->first()
->delete();
</code>
init()   X-Ref
No description



Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1