PHP code example of forikal-uk / xml-authoring-library

1. Go to this page and download the library: Download forikal-uk/xml-authoring-library 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/ */

    

forikal-uk / xml-authoring-library example snippets


use XmlSquad\Library\GoogleAPI\GoogleAPIClient;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class MyCommand extends Command
{
    execute(InputInterface $input, OutputInterface $output)
    {
        $googleClient = new GoogleAPIClient(); // You can pass a \Google_Client mock to the constructor. It will be used in the Google services.
        
        if (!$googleClient->authenticateFromCommand(
            $input,
            $output
            'google-client-secret.json', // A path to a Google API client secret file
            'google-access-token.json', // A path to a file where to store a Google API access token so the helper won't prompt to authenticate next time
            [\Google_Service_Drive::DRIVE_READONLY, \Google_Service_Sheets::SPREADSHEETS_READONLY] // A list of 

use XmlSquad\Library\Console\ConsoleLogger;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Psr\Log\LogLevel;

// ...

protected function execute(InputInterface $input, OutputInterface $output)
{
    $consoleLogger = new ConsoleLogger($output, [
        LogLevel::DEBUG  => OutputInterface::VERBOSITY_VERY_VERBOSE,
        LogLevel::INFO   => OutputInterface::VERBOSITY_VERBOSE,
        LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL
    ], [
        LogLevel::DEBUG  => '',
        LogLevel::INFO   => '',
        LogLevel::NOTICE => 'info'
    ]);
    
    $service = new MyService($consoleLogger);
}