PHP code example of elite42 / trackpms

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

    

elite42 / trackpms example snippets


$apiSettings = new \elite42\trackpms\trackApiSettings( 
    url          : '{url}',
    key          : '{key}',
    secret       : '{secret}',
    enableCaching: true,
    cachePath    : 'C:/inetpub/cache',
    debugLogging : true,
    debugLogPath : 'C:/inetpub/logs'
);

$api         = new \elite42\trackpms\trackApi( $apiSettings );

try {
    $unit            = $api->getUnit( 145 );
    $unitCollections = $api->getUnitCollections( );
    $units           = $api->getUnits( [ 'size'=>100 ] );

    $reservation            = $api->getReservation( 1 );
    $reservations           = $api->getReservations( [ 'size' => 100 ] );
    $reservationCollections = $api->getReservationCollections( [ 'size' => 100 ] );
    
    $reservationFee = $api->getReservationFee( 1, 2 );
    $reservationFees = $api->getReservationFees( 1 );
    $reservationFeeCollections = $api->getReservationFeeCollections( 1 );
    
    $reservationNote = $api->getReservationNote( 1, 15 );
    $reservationNotes = $api->getReservationNotes( 1 );
    $reservationNoteCollections = $api->getReservationNoteCollections( 1 );
    
    $reservationRates = $api->getReservationRates( 1 );
    
    $amenity = $api->getAmenity( 1 );
    $amenities = $api->getAmenities( [ 'size' => 100 ] );
    $amenityCollections = $api->getAmenityCollections( [ 'size' => 100 ] );
    
    $amenityGroup            = $api->getAmenityGroup( 1 );
    $amenityGroups           = $api->getAmenityGroups( [ 'size' => 100 ] );
    $amenityGroupCollections = $api->getAmenityGroupCollections( [ 'size' => 100 ] );
    
    $customField            = $api->getCustomField( 1 );
    $customFields           = $api->getCustomFields( [ 'size' => 100 ] );
    $customFieldCollections = $api->getCustomFieldCollections( [ 'size' => 100 ] );
	
    $maintenanceWorkOrder            = $api->getMaintenanceWorkOrder( 3 );
    $maintenanceWorkOrders           = $api->getMaintenanceWorkOrders( [ 'size' => 100 ] );
    $maintenanceWorkOrderCollections = $api->getMaintenanceWorkOrderCollections( [ 'size' => 100 ] );
    
    $owner            = $api->getOwner( 1000 );
    $owners           = $api->getOwners( [ 'size' => 100 ] );
    $ownerCollections = $api->getOwnerCollections( [ 'size' => 100 ] );
    $ownerUnits       = $api->getOwnerUnits( 1000 );
    
    $contract            = $api->getContract( 1 );
    $contracts           = $api->getContracts( [ 'size' => 100 ] );
    $contractCollections = $api->getContractCollections( [ 'size' => 100 ] );
    
    $unitRole            = $api->getUnitRole( 1000 );
    $unitRoles           = $api->getUnitRoles( [ 'size' => 100 ] );
    $unitRoleCollections = $api->getUnitRoleCollections( [ 'size' => 100 ] );
    
    $user            = $api->getUser( 1000 );
    $users           = $api->getUsers( [ 'size' => 100 ] );
    $userCollections = $api->getUserCollections( [ 'size' => 100 ] );
    
    
    $role            = $api->getRole( 1000 );
    $roles           = $api->getRoles( [ 'size' => 100 ] );
    $roleCollections = $api->getRoleCollections( [ 'size' => 100 ] );
}
catch( \elite42\trackpms\trackException $e ) {
    throw new controllerException( 'Error while running API command: '.$e->getMessage(), 400, $e);
}