https://github.com/librecodecoop/ojs-sdk
SDK package for the OJS
https://github.com/librecodecoop/ojs-sdk
ojs php php7 sdk sdk-php
Last synced: 9 months ago
JSON representation
SDK package for the OJS
- Host: GitHub
- URL: https://github.com/librecodecoop/ojs-sdk
- Owner: LibreCodeCoop
- License: gpl-3.0
- Created: 2019-11-08T21:19:32.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-04-19T21:19:28.000Z (over 2 years ago)
- Last Synced: 2025-01-17T12:17:00.635Z (10 months ago)
- Topics: ojs, php, php7, sdk, sdk-php
- Language: PHP
- Homepage:
- Size: 93.8 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# OJS-SDK
SDK package for the [OJS](https://pkp.sfu.ca/ojs/)
## Install
```bash
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.
| Environment | Suggested value | Usage |
| --------------- | ----------------------------------------------- | ----------------------------------------- |
| OJS_VERSION | 3_2_1-1 | Setup development environment with Docker |
| DB_PASSWD | root | Setup development environment with Docker |
| OJS_WEB_BASEDIR | /app/ojs | For make all |
| OJS_LOGIN_URL | http://localhost/ojs/index.php/journal/login/signIn | Only for login |
## How to use?
* Create or update user:
```php
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
```php
use OjsSdk\Services\OJSService\Users\OJSUserService;
$OjsClient = new OJSUserService();
$OjsClient->changePassword('jhonusername', '123password');
```
* getUniqueUsername
```php
use OjsSdk\Services\OJSService\Users\OJSUserService;
$OjsClient = new OJSUserService();
$uniqueUsername = $OjsClient->getUniqueUsername('jhonusername', '123password');
```
* Login
```php
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](tests/Services/OJSService/Users/OJSUserServiceTest.php) or [OJSUserService.php](src/Services/OJSService/Users/OJSUserService.php).
## Development
Use Docker for create a development environment.
If you don't use Docker, read the [entrypoint.sh](.docker/php7/entrypoint.sh) and [Dockerfile](.docker/php7/Dockerfile).
Running tests:
```bash
composer test
```