PHP code example of lyseontech / ojs-sdk

1. Go to this page and download the library: Download lyseontech/ojs-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lyseontech / ojs-sdk example snippets


use OjsSdk\Services\OJSService\Users\OJSUserService;

$OjsClient = new OJSUserService();
$return = $OjsClient->createUpdateUser([
    'username'       => 'jhonusername',
    'password'       => '123password',
    'email'          => '[email protected]',
    'mailingAddress' => 'Street 55',
    'locales'        => ['en_US'],
    'groups'         => [1], // administrator
    'givenName'      => ['en_US' => 'Jhon'],
    'familyName'     => ['en_US' => 'Doe'],
    'phone'          => '+123456789',
    'lattes'         => 'https://lattes.com'
]);

use OjsSdk\Services\OJSService\Users\OJSUserService;

$OjsClient = new OJSUserService();
$OjsClient->changePassword('jhonusername', '123password');

use OjsSdk\Services\OJSService\Users\OJSUserService;

$OjsClient = new OJSUserService();
$uniqueUsername = $OjsClient->getUniqueUsername('jhonusername', '123password');

use OjsSdk\Services\OJSService\Users\OJSUserService;

$OjsClient = new OJSUserService();
$loginResponse = $OjsClient->login('jhonusername', '123password');