egnyte-php / egnyte
Manage Egnyte uploads with the Egnyte public API
1.0-alpha3
2022-04-22 01:04 UTC
Requires
- php: >=8.0
- ext-curl: *
- php-curl-class/php-curl-class: ^9.6
Requires (Dev)
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.6
- vlucas/phpdotenv: ^2.4@dev
This package is auto-updated.
Last update: 2024-10-14 12:45:35 UTC
README
Egnyte PHP Client
Updates
- moved to EgnytePhp namespace
- added linting
- php 8.0+
- @todo Chunked Upload
- @todo TestCases
Prelim
-
Sign up for a developer key at (develpers.egnyte.com)[https://develpers.egnyte.com]
-
Key should be "internal app"
-
provide the API Subdomain of your egnyte account
-
-
Make sure you have credentials for the web UI. This login is called the "resource owner" credentials.
-
Wait for your API key to be approved (usually less than 24 hours).
Important: It's important at this point to have the following values:
$key = API Key
$secret = API Secret
$username = Resource Owner Username
$password = Resource Owner Password
Usage
$api_subdomain = 'something-something'; // ==> becomes something-something.egnyte.com $oauth = new \Oauth($key, $secret, OAUTH_SIG_METHOD_HMACSHA256, OAUTH_AUTH_TYPE_FORM); $tokenArray = $oauth->getRequestToken($api_subdomain ".egnyte.com/puboauth/token", [ "username" => $username, "password" => $password, "grant_type" => "password" ]); $client = new \EgnytePhp\Egnyte\Client( $api_subdomain, $tokenArray['access_token']); $fileClient = new \EgnytePhp\Egnyte\Model\File( $client ); // OR $fileClient = new \EgnytePhp\Egnyte\Model\File( null, 'domain', 'oauth token' ); $response = $fileClient->upload('/Shared/Documents/test.txt', 'test file upload' );