PHP code example of grant / powerschool-plugin-xml-builder

1. Go to this page and download the library: Download grant/powerschool-plugin-xml-builder 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/ */

    

grant / powerschool-plugin-xml-builder example snippets


use GrantHolle\PowerSchool\Plugin\PluginXmlBuilder;
use GrantHolle\PowerSchool\Plugin\UiContext;

/**
 * @var string
 */
$output = (new PluginXmlBuilder)
    ->version('1.1.1')
    ->description('A simple plugin')
    ->name('Simple Plugin')
    ->publisher('Joe Montana', '[email protected]')
    ->openId('example.com', 8443)
    ->addOpenIdLink('My OpenID link', '/path', 'My OpenID title', [
        UiContext::ADMIN_HEADER,
        UiContext::STUDENT_HEADER,
    ])
    ->addLink('My link', 'http://example.com', 'My title', UiContext::GUARDIAN_HEADER)
    ->addAccessRequest('students', 'dcid')
    ->addAccessRequest('students', 'first_name', true)
    ->addAccessRequest('students', 'last_name', true)
    ->saml('mysaml', 'http://example.com/saml', 'http://example.com/', 'http://example.com/metadata')
    ->addSamlLink('SAML', 'http://example.com/saml/login', 'SAML SP', [
        UiContext::ADMIN_HEADER,
        UiContext::ADMIN_LEFT_NAV,
    ])
    ->addSamlAttribute('admin', 'firstName')
    ->addSamlAttribute('admin', 'lastName', 'altLastName', 'myvalue')
    ->addSamlAttribute('student', 'first_name', 'first')
    ->addSamlPermission('permission1', 'A sample permission', 'abc123')
    ->addSamlPermission('permission2', 'Another sample permission', 'def456')
    ->oauth()
    ->autoEnable()
    ->autoRegister()
    ->autoDeploy()
    ->cantDelete()
    // By default is "pretty" and validated
    ->create();
    // Not pretty
    // ->create(false);
    // Not pretty or validated
    // ->create(false, false);