lyseontech / ojs-sdk
SDK package for OJS
v0.1.4
2022-01-23 17:12 UTC
Requires (Dev)
- guzzlehttp/guzzle: ^6.4
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-10-20 01:05:32 UTC
README
OJS-SDK
SDK package for the OJS
Install
composer require librecodecoop/ojs-sdk
Configure
OJS installed in the same server is necessary. Inform the path of OJS for all dependencies and the login URL if you need make login and get a user token after login.
How to use?
- Create or update user:
use OjsSdk\Services\OJSService\Users\OJSUserService; $OjsClient = new OJSUserService(); $return = $OjsClient->createUpdateUser([ 'username' => 'jhonusername', 'password' => '123password', 'email' => 'jhon.doe@test.coop', 'mailingAddress' => 'Street 55', 'locales' => ['en_US'], 'groups' => [1], // administrator 'givenName' => ['en_US' => 'Jhon'], 'familyName' => ['en_US' => 'Doe'], 'phone' => '+123456789', 'lattes' => 'https://lattes.com' ]);
- changePassword
use OjsSdk\Services\OJSService\Users\OJSUserService; $OjsClient = new OJSUserService(); $OjsClient->changePassword('jhonusername', '123password');
- getUniqueUsername
use OjsSdk\Services\OJSService\Users\OJSUserService; $OjsClient = new OJSUserService(); $uniqueUsername = $OjsClient->getUniqueUsername('jhonusername', '123password');
- Login
use OjsSdk\Services\OJSService\Users\OJSUserService; $OjsClient = new OJSUserService(); $loginResponse = $OjsClient->login('jhonusername', '123password');
Make anyfing
The method OjsProvider::getApplication();
make all necessary to use all classes of OJS.
For more informations see OJSUserServiceTest.php or OJSUserService.php.
Development
Use Docker for create a development environment.
If you don't use Docker, read the entrypoint.sh and Dockerfile.
Running tests:
composer test