PHP code example of mishonorarios / mishonorarios-php
1. Go to this page and download the library: Download mishonorarios/mishonorarios-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/ */
mishonorarios / mishonorarios-php example snippets
use MisHonorarios\Client;
$mishonorarios = new Client('https://tu-dominio/api/v1', 'mishonorarios_tu_token');
// Estado del emisor y del plan
$me = $mishonorarios->me();
echo $me['plan']['disponibles']; // cupo restante
// Emitir una boleta (receptor nacional)
$boleta = $mishonorarios->boletas()->emit([
'receptor' => [
'rut' => '12.345.678-5',
'nombre' => 'Cliente SpA',
'direccion' => 'Av. Siempre Viva 123',
'region_code' => '13',
'comuna_code' => '13101',
],
'detalle' => [
['descripcion' => 'Asesoría contable abril', 'monto' => 120000],
],
]);
echo $boleta['folio'];
// Descargar el PDF (las boletas se identifican por su folio del SII)
file_put_contents('boleta.pdf', $mishonorarios->boletas()->pdf($boleta['folio']));
// Listar boletas
$lista = $mishonorarios->boletas()->list(['per_page' => 50, 'status' => 'issued']);
// Anular (por folio)
$mishonorarios->boletas()->cancel($boleta['folio'], causa: 3);
// Clientes
$mishonorarios->clientes()->create(['rut' => '11.111.111-1', 'nombre' => 'Otro Cliente']);