smartoysters / saferme-api
SaferMe API client for PHP
Installs: 6 050
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.1|^8.0
- ext-json: *
- guzzlehttp/guzzle: ~7.0|~6.0|~5.0|~4.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-30 02:34:30 UTC
README
This package provides a complete framework agnostic SaferMe API client library for PHP.
Feel free to drop me a message at james.rickard@oceanfarmr.com or tweet me at @frodosghost.
Documentation
Check out the SaferMe Docs.
Installation
You can install the package via composer require
command:
composer require smartoysters/saferme-api
Or simply add it to your composer.json dependences and run composer update
:
"require": { "smartoysters/saferme-api": "^1.0" }
Usage
Following details provided on the authentication doc page.
$installationId
is requested to be something-unique-for-this-client-this-app-and-this-api-key
. We generated this value at random.org, and select one of the generated keys, and use that in the integration.
$teamId
is set to extract information from an Organisation within SaferMe.
$email = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'; $password = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'; $appId = 'com.thundermaps.main'; $appBundleId = 'com.thundermaps.saferme'; $teamId = 1234; $installationId = ''; $saferme = new SaferMe::OAuth([ 'email' => $email, 'password' => $password, 'appId' => $appId, 'appBundleId' => $appBundleId, 'installationId' => $installationId ]);
Teams
If you are using this Client to access multiple teams, you can configure to inject a single team in the Constructor, and reference another team in with ->team()
function before calling your endpoint.
// As above $saferme = new SaferMe::OAuth([ 'email' => $email, 'password' => $password, 'appId' => $appId, 'teamId' => $teamId, 'appBundleId' => $appBundleId, 'installationId' => $installationId ]); $teamId = 4321; $saferme->team($teamId)->channels()->list();
Guzzle Client Options
The options value in the constructor allows configuration for the Guzzle Client to set any number of default request options.
$options = [ 'timeout' => 0, 'allow_redirects' => false, 'proxy' => '192.168.16.1:10' ]; $saferme = new SaferMe::OAuth([ 'email' => $email, 'password' => $password, 'appId' => $appId, 'installationId' => $installationId, 'options' => $options ]);
Inspiration
This package's inspiration is taken from the Devio/Pipedrive - it is such a nice code format for API interaction. Check him out on twitter :: @IsraelOrtuno.