-
Notifications
You must be signed in to change notification settings - Fork 2
Home
MercierCorentin edited this page Apr 13, 2019
·
3 revisions
Forked from MasterZero/laravel-nextcloud-user-management.
The rest is based on Nextcloud provisionning API doc and Nextcloud source code. When the documentation had some lacks, I submited PR:
This API client is divided in three parts:
- Use following command in your terminal to install this library. (Currently the library is in development mode):
composer require MercierCorentin/nextcloud dev-master- Create
config/nextcloud.phpwith content:
return [
'login'=> env('NEXTCLOUD_LOGIN', 'admin'),
'password'=> env('NEXTCLOUD_PASSWORD', '12345678'),
'baseUrl'=> env('NEXTCLOUD_BASEURL', 'http://localhost'),
];- Add these params to
.env(recommended):
NEXTCLOUD_LOGIN=admin
NEXTCLOUD_PASSWORD=12345678
NEXTCLOUD_BASEURL=http://localhost
use MercierCorentin\Nextcloud\Exceptions\XMLParseException;
use MercierCorentin\Nextcloud\Exceptions\CurlException;
// ...
try {
// reqeust to API
UserApi::editUser('rabbit','quota', '200 MB');
} catch (XMLParseException $e) {
// bad nextcloud answer
} catch (CurlException $e) {
// bad connection
} catch (\Exception $e) {
// bad something else
}// Exaple for UserApi
use MercierCorentin\Nextcloud\User\UserApi;
// ...
//
$api = new UserApi([
'baseUrl' => 'http://develop.localhost:3500',
'login' => 'admin',
'password' => '12345678',
'sslVerify' => false,
// use default value
// 'apiPath' => 'custom/path/to/api.php',
// 'userPath' => '',
// 'enablePath' => '',
// 'disablePath' => '',
]);
$api->createUser( 'dummy', 'azerty');