PHP code example of apdevs / sw-sdk-php

1. Go to this page and download the library: Download apdevs/sw-sdk-php 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/ */

    

apdevs / sw-sdk-php example snippets


{
    "name": "martinflores/implement",
    "authors": [
        {
            "name": "Martin Flores",
            "email": "[email protected]"
        }
    ],
    "

	

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "proxy"=> "server.domain.com:8888"
    );


    rvices\Authentication\AuthenticationService  as Authentication;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"cuentaUsuario",
        "password"=> "contraseña"
    );
    try
    {
        header('Content-type: application/json');
        Authentication::auth($params);
        $token = Authentication::Token();
        echo $token;
    }
    catch(Exception $e)
    {
        header('Content-type: text/plain');
        echo 'Caught exception: ',  $e->getMessage(), "\n";
    }


    WServices\Stamp\StampService as StampService;
     try{
        header('Content-type: application/json');

        $params = array(
            "url"=>"http://services.test.sw.com.mx",
            "user"=>"cuentaUsuario",
            "password"=> "contraseña"
            );
        $xml = file_get_contents('./file.xml');
        StampService::Set($params);
        $result = StampService::StampV1($xml);
        var_dump($result);

    }
    catch(Exception $e){
        header('Content-type: text/plain');
        echo 'Caught exception: ',  $e->getMessage(), "\n";
    }


    WServices\Stamp\StampService as StampService;

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "token"=>"T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE..............."
    );

    try
    {
        header('Content-type: application/json');
        $xml = file_get_contents('./file.xml');
        StampService::Set($params);
        $result = StampService::StampV1($xml);
        var_dump($result);
    }
    catch(Exception $e)
    {
        header('Content-type: text/plain');
        echo $e->getMessage();
    }

    $params = array(
        
        "proxy"=> "server.domain.com"
    );


    WServices\Stamp\StampService as StampService;
     try{
        header('Content-type: application/json');

        $params = array(
            "url"=>"http://services.test.sw.com.mx",
            "user"=>"cuentaUsuario",
            "password"=> "contraseña"
            );
        $xml = file_get_contents('./file.xml');
        StampService::Set($params);
        $result = StampService::StampV2($xml);
        var_dump($result);

    }
    catch(Exception $e){
        header('Content-type: text/plain');
        echo 'Caught exception: ',  $e->getMessage(), "\n";
    }


    WServices\Stamp\StampService as StampService;

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "token"=>"T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE..............."
    );

    try
    {
        header('Content-type: application/json');
        $xml = file_get_contents('./file.xml');
        StampService::Set($params);
        $result = StampService::StampV2($xml);
        var_dump($result);
    }
    catch(Exception $e)
    {
        header('Content-type: text/plain');
        echo $e->getMessage();
    }


    WServices\Stamp\StampService as StampService;

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "token"=>"T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE..............."
    );

    try
    {
        header('Content-type: application/json');
        $xml = file_get_contents('./file.xml');
        StampService::Set($params);
        //Se agrega un segundo parametro de tipo boolean para activar la modalidad base64
        $result = StampService::StampV2($xml,true);
        var_dump($result);
    }
    catch(Exception $e)
    {
        header('Content-type: text/plain');
        echo $e->getMessage();
    }


    WServices\Stamp\StampService as StampService;
     try{
        header('Content-type: application/json');

        $params = array(
            "url"=>"http://services.test.sw.com.mx",
            "user"=>"cuentaUsuario",
            "password"=> "contraseña"
            );
        $xml = file_get_contents('./file.xml');
        StampService::Set($params);
        $result = StampService::StampV3($xml);
        var_dump($result);

    }
    catch(Exception $e){
        header('Content-type: text/plain');
        echo 'Caught exception: ',  $e->getMessage(), "\n";
    }


    WServices\Stamp\StampService as StampService;

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "token"=>"T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE..............."
    );

    try
    {
        header('Content-type: application/json');
        $xml = file_get_contents('./file.xml');
        StampService::Set($params);
        $result = StampService::StampV3($xml);
        var_dump($result);
    }
    catch(Exception $e)
    {
        header('Content-type: text/plain');
        echo $e->getMessage();
    }


    WServices\Stamp\StampService as StampService;
     try{
        header('Content-type: application/json');

        $params = array(
            "url"=>"http://services.test.sw.com.mx",
            "user"=>"cuentaUsuario",
            "password"=> "contraseña"
            );
        $xml = file_get_contents('./file.xml');
        StampService::Set($params);
        $result = StampService::StampV4($xml);
        var_dump($result);

    }
    catch(Exception $e){
        header('Content-type: text/plain');
        echo 'Caught exception: ',  $e->getMessage(), "\n";
    }


    WServices\Stamp\StampService as StampService;

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "token"=>"T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE..............."
    );

    try
    {
        header("Content-type: application/json");
        $xml = file_get_contents("./file.xml");
        StampService::Set($params);
        $result = StampService::StampV4($xml);
        var_dump($result);
    }
    catch(Exception $e)
    {
        header("Content-type: text/plain");
        echo $e->getMessage();
    }


    WServices\Stamp\StampService as StampService;

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "token"=>"T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE..............."
    );

    try
    {
        header('Content-type: application/json');
        $xml = file_get_contents('./file.xml');
        StampService::Set($params);
        //Se agrega un segundo parametro de tipo boolean para activar la modalidad base64
        $result = StampService::StampV4($xml,true);
        var_dump($result);
    }
    catch(Exception $e)
    {
        header('Content-type: text/plain');
        echo $e->getMessage();
    }

    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"[email protected]",
        "password"=> "contraseña"
    );

    $xml = file_get_contents('Test/Resources/file.xml');
    EmisionTimbrado::Set($params);
    $resultadoIssue = EmisionTimbrado::EmisionTimbradoV1($xml);
    var_dump($resultadoIssue);

    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"[email protected]",
        "password"=> "contraseña"
    );

    $xml = file_get_contents('Test/Resources/file.xml');
    EmisionTimbrado::Set($params);
    $resultadoIssue = EmisionTimbrado::EmisionTimbradoV2($xml);
    var_dump($result);

    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"[email protected]",
        "password"=> "contraseña"
    );

    $xml = file_get_contents('Test/Resources/file.xml');
    EmisionTimbrado::Set($params);
    $resultadoIssue = EmisionTimbrado::EmisionTimbradoV3($xml);
    var_dump($result);

    use SWServices\Stamp\EmisionTimbrado  as EmisionTimbrado;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"[email protected]",
        "password"=> "contraseña"
    );

    $xml = file_get_contents('Test/Resources/file.xml');
    EmisionTimbrado::Set($params);
    $resultadoIssue = EmisionTimbrado::EmisionTimbradoV4($xml);
    var_dump($result);

    use SWServices\JSonIssuer\JsonEmisionTimbrado as JsonEmisionTimbrado;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"[email protected]",
        "password"=> "contraseña"
    );

    $json = file_get_contents("Test/Resources/cfdi.json");
    JsonEmisionTimbrado::Set($params);
    $resultadoJson = JsonEmisionTimbrado::jsonEmisionTimbradoV1($json);
    var_dump($resultadoJson);

    use SWServices\JSonIssuer\JsonEmisionTimbrado as JsonEmisionTimbrado;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"[email protected]",
        "password"=> "contraseña"
    );

    $json = file_get_contents("Test/Resources/cfdi.json");
    JsonEmisionTimbrado::Set($params);
    $resultadoJson = JsonEmisionTimbrado::jsonEmisionTimbradoV2($json);
    var_dump($resultadoJson);

    use SWServices\JSonIssuer\JsonEmisionTimbrado as jsonEmisionTimbrado;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"[email protected]",
        "password"=> "contraseña"
    );

    $json = file_get_contents("Test/Resources/cfdi.json");
    jsonEmisionTimbrado::Set($params);
    $resultadoJson = JsonEmisionTimbrado::jsonEmisionTimbradoV3($json);
    var_dump($resultadoJson);

    use SWServices\JSonIssuer\JsonEmisionTimbrado as JsonEmisionTimbrado;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"[email protected]",
        "password"=> "contraseña"
    );

    $json = file_get_contents("Test/Resources/cfdi.json");
    JsonEmisionTimbrado::Set($params);
    $resultadoJson = JsonEmisionTimbrado::jsonEmisionTimbradoV4($json);
    var_dump($resultadoJson);

 
    Services\Cancelation\CancelationService as CancelationService;

    $rfc="";
    $password="";
    $uuid=" ";
    $motivo="01";
    $foliosustitucion=" ";
    $b64Cer="MIIFuzCCA6OgAwIBAgIU.........";
    $b64Key="MIIFDjBABgkqhkiG9w0B.........";
    $url="http://services.test.sw.com.mx/";
    $token=" ";
 
    $params = array(
        "url"=>$url,  
        "token"=>$token,
    );
    
    try {
        header('Content-type: application/json');
        $cancelationService = CancelationService::Set($params);
        $result = $cancelationService::CancelationByCSD($rfc, $uuid, $motivo, $b64Cer, $b64Key, $password,$foliosustitucion);
        echo json_encode($result);
    } catch(Exception $e) {
        header('Content-type: text/plain');
        echo $e->getMessage();
    }

 
    Services\Cancelation\CancelationService as CancelationService;

    $resultSpect = "success";
	$params = array(
		"url"=>"http://services.test.sw.com.mx/",	
		"token"=>" "				
	);
            $xml=file_get_contents("../Test/Resources/CancelationResources/cancelByXml.xml");
		    try {
		        $cancelationService = CancelationService::Set($params);
		        $result = $cancelationService::CancelationByXML($xml);
                echo json_encode($result);
            } catch(Exception $e) {
                header('Content-type: text/plain');
                echo $e->getMessage();
            }

 
    Services\Cancelation\CancelationService as CancelationService;

    $rfc=" ";
    $password=" ";
    $uuid=" ";
    $motivo=" ";
    $foliosustitucion=" ";
    $b64Pfx="MIIL+QIBAzCCC.................";
    $url="http://services.test.sw.com.mx/";
    $token=" ";

    $params = array(
        "url"=>$url,  
        "token"=>$token
    );

    try {
        header('Content-type: application/json');
        $cancelationService = CancelationService::Set($params);
        $result = $cancelationService::CancelationByPFX($rfc, $uuid, $motivo, $pfxB64, $passwordPfx,$foliosustitucion);
        echo json_encode($result);
    } catch(Exception $e) {
        header('Content-type: text/plain');
        echo $e->getMessage();
    }

 
    Services\Cancelation\CancelationService as CancelationService;

    $rfc=" ";
    $uuid=" ";
    $motivo=" ";
    $foliosustitucion=" ";
    $params = array(
        "url"=>"http://services.test.sw.com.mx",  
        "token"=>" "
    );
    
    try {
        header('Content-type: application/json');
        $cancelationService = CancelationService::Set($params);
        $result = $cancelationService::CancelationByUUID($rfc, $uuid, $motivo,$foliosustitucion);
        echo json_encode($result);
    } catch(Exception $e) {
        header('Content-type: text/plain');
        echo $e->getMessage();
    }


    WServices\AccountBalance\AccountBalanceService as AccountBalanceService;

    $params = array(
        'url'=> 'services.test.sw.com.mx',
        'token'=> 'T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE...............',
    );
    try {
        AccountBalanceService::Set($params);
        $result = AccountBalanceService::GetAccountBalance();
        var_dump($result);
    } catch(Exception $e) {
        echo 'Caught exception: ',  $e->getMessage(), "\n";
    }

     use SWServices\SatQuery\SatQueryService as SatQueryService;

    $soapUrl = "http://consultaqrfacturaelectronicatest.sw.com.mx/ConsultaCFDIService.svc";
    $re = "LAN8507268IA";
    $rr = "LAN7008173R5";
    $tt = 5800.00;
    $uuid = "6ab07bef-4446-43ea-a3fd-04a804309457";
    $sello = "zNDhfw=";
    $consultaCfdi = SatQueryService::ServicioConsultaSAT($soapUrl, $re, $rr, $tt, $uuid, $sello);
    var_dump($consultaCfdi);

     use SWServices\Cancelation\CancelationService as cancelationService;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"cuentaUsuario",
        "password"=> "contraseña"
    );

    $rfc = "LAN7008173R5";
    cancelationService::Set($params);
    $consultaPendientes = cancelationService::PendientesPorCancelar($rfc);
    var_dump($consultaPendientes);

     use SWServices\AcceptReject\AcceptRejectService as AcceptRejectService;

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"cuentaUsuario",
        "password"=> "contraseña"
    );
    $cerB64 = base64_encode(file_get_contents('Test\Resources\cert_pruebas\EKU9003173C9.cer'));
    $keyB64 = base64_encode(file_get_contents('Test\Resources\cert_pruebas\EKU9003173C9.key'));
    $password = "12345678a";
    $rfc = "EKU9003173C9";
    $list = [
        ['uuid' => 'dcbddeb9-a208-42be-ae5b-0390a929fe48', 'action' => 'Aceptacion']
    ];
    $acceptReject = AcceptRejectService::Set($params);
    $aceptarRechazar = $acceptReject::AceptarRechazarCancelacionCSD($rfc, $list, $cerB64, $keyB64, $password);
    var_dump($aceptarRechazar);

     use SWServices\AcceptReject\AcceptRejectService as AcceptRejectService;

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"cuentaUsuario",
        "password"=> "contraseña"
    );

    $pfxB64 = base64_encode(file_get_contents('Test\Resources\cert_pruebas\EKU9003173C9.pfx'));
    $passwordPfx = "swpass";
    $rfc = "EKU9003173C9";
    $list = [
        ['uuid' => 'dcbddeb9-a208-42be-ae5b-0390a929fe48', 'action' => 'Aceptacion']
    ];
            
    $acceptReject = AcceptRejectService::Set($params);
    $aceptarRechazar = $acceptReject::AceptarRechazarCancelacionPFX($rfc, $list, $pfxB64, $passwordPfx);
    var_dump($aceptarRechazar);

     use SWServices\AcceptReject\AcceptRejectService as AcceptRejectService;

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"cuentaUsuario",
        "password"=> "contraseña"
    );
    $xml = file_get_contents('Test\Resources\acceptReject_xml.xml');

    $acceptReject = AcceptRejectService::Set($params);
    $aceptarRechazar = $acceptReject::AceptarRechazarCancelacionXML($xml);
    var_dump($aceptarRechazar);

     use SWServices\AcceptReject\AcceptRejectService as AcceptRejectService;

    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"cuentaUsuario",
        "password"=> "contraseña"
    );

    $rfc = "EKU9003173C9";
    $uuid = "dcbddeb9-a208-42be-ae5b-0390a929fe48";
    $action = "Rechazo";

    $acceptReject = AcceptRejectService::Set($params);
    $aceptarRechazar = $acceptReject::AceptarRechazarCancelacionUUID($rfc, $uuid, $action);
    var_dump($aceptarRechazar);

     use SWServices\Cancelation\CancelationService as cancelationService;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"cuentaUsuario",
        "password"=> "contraseña"
    );

    $cerB64 = base64_encode(file_get_contents('Test\Resources\CSD_Pruebas_CFDI_LAN7008173R5.cer'));
    $keyB64 = base64_encode(file_get_contents('Test\Resources\CSD_Pruebas_CFDI_LAN7008173R5.key'));
    $rfc = "LAN7008173R5";
    $uuid = "52c02b64-d12e-4163-b581-bf749238896d";
    cancelationService::Set($params);
    $consultaRelacionados = cancelationService::ConsultarCFDIRelacionadosCSD($rfc, $cerB64, $keyB64, $password, $uuid);
    var_dump($consultaRelacionados);

     use SWServices\Cancelation\CancelationService as cancelationService;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"cuentaUsuario",
        "password"=> "contraseña"
    );
    
    $pfxB64 = base64_encode(file_get_contents('Test\Resources\CSD_Pruebas_CFDI_LAN7008173R5.pfx'));
    $rfc = "LAN7008173R5";
    $uuid = "52c02b64-d12e-4163-b581-bf749238896d";
    cancelationService::Set($params);
    $consultaRelacionados = cancelationService::ConsultarCFDIRelacionadosPFX($rfc, $pfxB64, $password, $uuid);
    var_dump($consultaRelacionados);

     use SWServices\Cancelation\CancelationService as cancelationService;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"cuentaUsuario",
        "password"=> "contraseña"
    );

    $rfc = "LAN7008173R5";
    $uuid = "52c02b64-d12e-4163-b581-bf749238896d";
    $xml = file_get_contents('Test\Resources\fileRelations.xml');
    cancelationService::Set($params);
    $consultaRelacionados = cancelationService::ConsultarCFDIRelacionadosXML($xml);
    var_dump($consultaRelacionados);

     use SWServices\Cancelation\CancelationService as cancelationService;
    $params = array(
        "url"=>"http://services.test.sw.com.mx",
        "user"=>"cuentaUsuario",
        "password"=> "contraseña"
    );

    $rfc = "LAN7008173R5";
    $uuid = "52c02b64-d12e-4163-b581-bf749238896d";
    cancelationService::Set($params);
    $consultaRelacionados = cancelationService::ConsultarCFDIRelacionadosUUID($rfc, $uuid);
    var_dump($consultaRelacionados);


use SWServices\PDF\PDFService as pdfService;

    $xml = "<?xml version='1.0' encoding='utf-8'


use SWServices\PDF\PDFService as pdfService;

    $xml = "<?xml version='1.0' encoding='utf-8'



use SWServices\PDF\PDFService as pdfService;

    $uuid = "604729a6-a1d9-4969-b35f-e7d04c7ad75c";
    $params = array(
        "urlApi" => "https://api.test.sw.com.mx",
        "url" => "https://services.test.sw.com.mx",
        "user" => "usuario",
        "password" => "contraseña"
    );
    $pdfService = pdfService::Set($params);
    $result = $pdfService::RegeneratePDF($uuid);
    var_dump($result);



use SWServices\PDF\PDFService as pdfService;
    //Si se cuentan con distintos templateId, 
    //es necesario especificarlo
    $extras =  array(
        "extras"=>array(
            "EDIRECCION1"=>"STERNO PRODUCTS 2483 Harbor Avenue Memphis, TN 38113"
        ),
        "templateId"=>"extradata"
    );
    $params = array(
        "urlApi" => "https://api.test.sw.com.mx",
        "url" => "https://services.test.sw.com.mx",
        "user" => "usuario",
        "password" => "contraseña"
    );
    $pdfService = pdfService::Set($params);
    $result = $pdfService::RegeneratePDF($uuid,$extras);
    var_dump($result);
    

$params = array(
    "urlApi" => "https://api.test.sw.com.mx",
    "url" => "https://services.test.sw.com.mx",
    "user"=>"[email protected]",
    "password"=> "password"
);
$resend = ResendService::Set($params);

$params = array(
    "urlApi" => "https://api.test.sw.com.mx",
    "token" => "T2lYQ0t4L0RHVkR..."
);
$resend = ResendService::Set($params);

$emails = array(
    "[email protected]"
);
$result = $resend::ResendEmail("506aecd4-fc5f-4581-a0e1-9b185967b212", $emails);

$emails = array(
    "[email protected]",
    "[email protected]"
);
$result = $resend::ResendEmail("506aecd4-fc5f-4581-a0e1-9b185967b212", $emails);


    WServices\Csd\CsdService as CsdService;

    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "user" => "usuario",
        "password" => "contraseña"
    );
    CsdService::Set($params);
    $response = CsdService::GetListCsd();
    var_dump($response);


    WServices\Csd\CsdService as CsdService;

    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "user" => "usuario",
        "password" => "contraseña"
    );
    CsdService::Set($params);
    $response = CsdService::GetListCsdByRfc('EKU9003173C9');
    var_dump($response);


    WServices\Csd\CsdService as CsdService;

    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "user" => "usuario",
        "password" => "contraseña"
    );
    CsdService::Set($params);
    $response = CsdService::InfoCsd('20001000000300022816');
    var_dump($response);


    WServices\Csd\CsdService as CsdService;
    
    $b64Cer = base64_encode(file_get_contents('EKU9003173C9.cer'));
    $b64Key = base64_encode(file_get_contents('EKU9003173C9.key'));
    $password = "12345678a";
    $type = "stamp";
    $isActive = true;
    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "user" => "usuario",
        "password" => "contraseña"
    );
    CsdService::Set($params);
    $response = CsdService::UploadCsd($isActive, $type, $b64Cer, $b64Key, $password);
    var_dump($response);


    WServices\Csd\CsdService as CsdService;

    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "user" => "usuario",
        "password" => "contraseña"
    );
    CsdService::Set($params);
    $response = CsdService::DisableCsd('20001000000300022763');
    var_dump($response);


    SWServices\PDF\PDFService as pdfService;
    use SWServices\Stamp\StampService as StampService;
    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;

    $prefixOne = date('Y-m-d');
    $prefixTwo = rand(0, 555);
    $customId = "Serie-" . $prefixOne . "-" . $prefixTwo;
    $resultSpect = "success";
    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "token" => "T2lYQ0t4L0R...."
    );
    $xml = file_get_contents('./file.xml');

    $stamp = EmisionTimbrado::Set($params);
    $result = $stamp::issueV4CustomIdPdfV1($xml, $customId); 
    var_dump($result);



    SWServices\PDF\PDFService as pdfService;
    use SWServices\Stamp\StampService as StampService;
    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;

    $prefixOne = date('Y-m-d');
    $prefixTwo = rand(0, 555);
    $customId = "Serie-" . $prefixOne . "-" . $prefixTwo;
    $resultSpect = "success";
    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "token" => "T2lYQ0t4L0R...."
    );
    $xml = file_get_contents('./file.xml');

    $stamp = EmisionTimbrado::Set($params);
    $result = $stamp::issueV4CustomIdPdfV2($xml, $customId); 
    var_dump($result);



    SWServices\PDF\PDFService as pdfService;
    use SWServices\Stamp\StampService as StampService;
    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;

    $prefixOne = date('Y-m-d');
    $prefixTwo = rand(0, 555);
    $customId = "Serie-" . $prefixOne . "-" . $prefixTwo;
    $resultSpect = "success";
    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "token" => "T2lYQ0t4L0R...."
    );
    $xml = file_get_contents('./file.xml');

    $stamp = EmisionTimbrado::Set($params);
    $result = $stamp::issueV4CustomIdPdfV3($xml, $customId); 
    var_dump($result);


    SWServices\PDF\PDFService as pdfService;
    use SWServices\Stamp\StampService as StampService;
    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;

    $prefixOne = date('Y-m-d');
    $prefixTwo = rand(0, 555);
    $customId = "Serie-" . $prefixOne . "-" . $prefixTwo;
    $resultSpect = "success";
    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "token" => "T2lYQ0t4L0R...."
    );
    $xml = file_get_contents('./file.xml');

    $stamp = EmisionTimbrado::Set($params);
    $result = $stamp::issueV4CustomIdPdfV3($xml, $customId); 
    var_dump($result);



    SWServices\PDF\PDFService as pdfService;
    use SWServices\Stamp\StampService as StampService;
    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;

    $prefixOne = date('Y-m-d');
    $prefixTwo = rand(0, 555);
    $customId = "Serie-" . $prefixOne . "-" . $prefixTwo;
    $email = array("[email protected]", "[email protected]");
    $resultSpect = "success";
    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "token" => "T2lYQ0t4L0R...."
    );
    $xml = file_get_contents('./file.xml');

    $stamp = EmisionTimbrado::Set($params);
    $result = $stamp::issueV4CustomIdEmailV1($xml, $customId); 
    var_dump($result);



    SWServices\PDF\PDFService as pdfService;
    use SWServices\Stamp\StampService as StampService;
    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;

    $prefixOne = date('Y-m-d');
    $prefixTwo = rand(0, 555);
    $customId = "Serie-" . $prefixOne . "-" . $prefixTwo;
    $email = array("[email protected]", "[email protected]");
    $resultSpect = "success";
    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "token" => "T2lYQ0t4L0R...."
    );
    $xml = file_get_contents('./file.xml');

    $stamp = EmisionTimbrado::Set($params);
    $result = $stamp::issueV4CustomIdEmailV2($xml, $customId); 
    var_dump($result);



    SWServices\PDF\PDFService as pdfService;
    use SWServices\Stamp\StampService as StampService;
    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;

    $prefixOne = date('Y-m-d');
    $prefixTwo = rand(0, 555);
    $customId = "Serie-" . $prefixOne . "-" . $prefixTwo;
    $email = array("[email protected]", "[email protected]");
    $resultSpect = "success";
    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "token" => "T2lYQ0t4L0R...."
    );
    $xml = file_get_contents('./file.xml');

    $stamp = EmisionTimbrado::Set($params);
    $result = $stamp::issueV4CustomIdEmailV3($xml, $customId); 
    var_dump($result);



    SWServices\PDF\PDFService as pdfService;
    use SWServices\Stamp\StampService as StampService;
    use SWServices\Stamp\EmisionTimbrado as EmisionTimbrado;

    $prefixOne = date('Y-m-d');
    $prefixTwo = rand(0, 555);
    $customId = "Serie-" . $prefixOne . "-" . $prefixTwo;
    $email = array("[email protected]", "[email protected]");
    $resultSpect = "success";
    $params = array(
        "url" => "https://services.test.sw.com.mx",
        "token" => "T2lYQ0t4L0R...."
    );
    $xml = file_get_contents('./file.xml');

    $stamp = EmisionTimbrado::Set($params);
    $result = $stamp::issueV4CustomIdEmailV4($xml, $customId); 
    var_dump($result);