PHP code example of prestashop / prestashop-accounts-installer

1. Go to this page and download the library: Download prestashop/prestashop-accounts-installer 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/ */

    

prestashop / prestashop-accounts-installer example snippets


    $this->getService('ps_accounts.installer')->install();

    Media::addJsDef([
        'contextPsAccounts' => $this->getService('ps_accounts.facade')
            ->getPsAccountsPresenter()
            ->present($this->name),
    ]);

use PrestaShop\PsAccountsInstaller\Installer\Exception\ModuleVersionException;
use PrestaShop\PsAccountsInstaller\Installer\Exception\ModuleNotInstalledException;

try {
    $psAccountsService = $this->getService('ps_accounts.facade')->getPsAccountsService();

    $shopJwt = $psAccountsService->getOrRefreshToken();

    $shopUuid = $psAccountsService->getShopUuid();

    $apiUrl = $psAccountsService->getAdminAjaxUrl();

    // Your code here

} catch (ModuleNotInstalledException $e) {

    // You handle exception here

} catch (ModuleVersionException $e) {

    // You handle exception here
}