PHP code example of skmedia / solvice-client

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

    

skmedia / solvice-client example snippets


if ($job->isSolved()) {

    $response->getScore()->isFeasible();
    
    // Error messages (hard and soft constraints)
    echo $response->getUnresolvedItems()
        ->byLevel(SolviceEntity\UnresolvedItemLevel::HARD)
        ->joinBy('name');
    
    echo $response->getUnresolvedItems()
        ->byLevel(SolviceEntity\UnresolvedItemLevel::SOFT)
        ->joinBy('name');
    
    foreach ($response->getAssignments() as $assignment) {
        if ($assignment->hasRoomSlot()) {
            echo $assignment->getCluster()->getName()
                . ' is assigned to '
                . $assignment->getRoomSlot()->getRoom()->getName();
        }
    }
}