1. Go to this page and download the library: Download lexik/colissimo-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// use Lexik\Bundle\ColissimoBundle\Exception\InvalidRequestException;// use Lexik\Bundle\ColissimoBundle\Exception\FailedRequestException;
$colissimo = $this->container->get('lexik_colissimo.ws_coliposte_letter_service.service');
try {
$response = $colissimo->getLabel(
array('weight' => 1.780),
array(
'name' => 'Client Name',
'surname' => 'Client Surname',
'email' => 'client@email.com',
'line2' => 'Client Address',
'city' => 'Client City',
'postalCode' => 'Client Postal Code'
)
// you can overwrite the sender configured in you app/config.yml by passing an array as 3rd argument// you can disable validation by setting the 4th argument to false
);
// $response looks like this
object(WSColissimo\WSColiPosteLetterService\Response\ValueObject\ReturnLetter)[1102]
protected'file' => nullprotected'parcelNumber' => string '13xc1v654d123' (length=13)
protected'PdfUrl' => string 'https://ws.colissimo.fr/path/to/pdf-file' (length=40)
protected'errorID' => int 0protected'error' => string '' (length=0)
protected'signature' => nullprotected'dateCreation' => null
} catch (InvalidRequestException $e) {
// validation problems : you can iterate over errors with $e->getViolations()
} catch (FailedRequestException $e) {
// webservice returned an error : you can get the error message with $e->getMessage()
}
php composer.phar update lexik/colissimo-bundle
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.