Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akamai/akamaiopen-edgegrid-php
PHP library for Akamai {OPEN} EdgeGrid Authentication scheme (signing only)
https://github.com/akamai/akamaiopen-edgegrid-php
akamai akamai-devexp auth authentication authorization edgegrid open php signer
Last synced: 2 months ago
JSON representation
PHP library for Akamai {OPEN} EdgeGrid Authentication scheme (signing only)
- Host: GitHub
- URL: https://github.com/akamai/akamaiopen-edgegrid-php
- Owner: akamai
- License: apache-2.0
- Created: 2016-10-08T07:03:12.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-10-18T13:18:47.000Z (over 2 years ago)
- Last Synced: 2024-04-24T16:47:44.395Z (10 months ago)
- Topics: akamai, akamai-devexp, auth, authentication, authorization, edgegrid, open, php, signer
- Language: PHP
- Homepage: https://techdocs.akamai.com/home
- Size: 619 KB
- Stars: 14
- Watchers: 10
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# akamai-open/edgegrid-auth
[Akamai EdgeGrid Authentication](https://techdocs.akamai.com/developer/docs/set-up-authentication-credentials) for PHP
This library requires PHP 8+ and implements the Akamai EdgeGrid Authentication scheme for PHP.
## Install
To install, use [`composer`](http://getcomposer.org):
```sh
$ composer require akamai-open/edgegrid-auth
```### Alternative installation methods
#### Single file (PHAR)
Download the PHAR file from the [releases](https://github.com/akamai/AkamaiOPEN-edgegrid-php/releases) page and include it inside your code:
```php
include 'akamai-open-edgegrid-auth.phar';// Library is ready to use
```#### Clone or download
1. Either clone or download to pull down a copy of this repository.
* Clone the repository using [git](https://github.com/akamai/AkamaiOPEN-edgegrid-php.git) or [subversion](https://github.com/akamai/AkamaiOPEN-edgegrid-php).
* Download the latest [ZIP archive](https://github.com/akamai/AkamaiOPEN-edgegrid-php/archive/master.zip) or [specific release ZIP archive](https://github.com/akamai/AkamaiOPEN-edgegrid-php/releases).1. Use the composer autoloader and install the dependencies.
```bash
$ composer install
```1. Include the autoloader.
```php
require_once 'vendor/autoload.php';
```If you don't use the autoloader, include all the required classes manually in your code.
```php
require_once 'src/Authentication.php';
require_once 'src/Authentication/Timestamp.php';
require_once 'src/Authentication/Nonce.php';
require_once 'src/Authentication/Exception.php';
require_once 'src/Authentication/Exception/ConfigException.php';
require_once 'src/Authentication/Exception/SignerException.php';
require_once 'src/Authentication/Exception/SignerException/InvalidSignDataException.php';
```## Use
Once you have installed the library, you can create the header value by calling the appropriate `\Akamai\Open\Edgegrid\Authentication::set*()` methods.
For example, using it with the built-in streams HTTP client might look like the following:
```php
$auth = \Akamai\Open\EdgeGrid\Authentication::createFromEdgeRcFile('default', '/.edgerc');
$auth->setHttpMethod('GET');
$auth->setPath('/identity-management/v3/user-profile');$context = array(
'http' => array(
'header' => array(
'Authorization: ' . $auth->createAuthHeader(),
'Content-Type: application/json'
)
)
);$context = stream_context_create($context);
$response = json_decode(file_get_contents('https://' . $auth->getHost() . $auth->getPath(), null, $context));
```## License
Copyright © 2022 Akamai Technologies, Inc. All rights reserved
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at .
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.