1. Go to this page and download the library: Download devaguia/correios-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/ */
devaguia / correios-php example snippets
// Parâmetros obrigatórios - Required Paramns
$correios = new \Correios\Correios(
username: 'user',
password: 'password',
postcard: 'postcard',
isTestMode: true
);
// Parâmetros opcionais - Optional parameters
$correios = new \Correios\Correios(
username: 'user',
password: 'password',
postcard: 'postcard',
isTestMode: true,
token: 'string'
);
// Use um número de requisição e ID do lot personalizado - Use a custom request number and Lot ID
$correios->setRequestNumber(requestNumber: '20230831');
$correios->setLotId(requestNumber: '20230831LT');