Use this file to discover all available pages before exploring further.
This guide walks you through the complete workflow: installing the library, instantiating the client, creating an issuer, building an invoice registration record, and submitting it to AEAT via the VeriFactuAPI. By the end you will have a working end-to-end PHP integration.
See Installation for the full details including the git clone method.
2
Instantiate the client
The constructor handles authentication automatically. It POSTs your credentials to the API and stores the Bearer token:
<?phprequire 'vendor/autoload.php';use verifactuPHP\ClienteVerifactu;$client = new ClienteVerifactu('you@example.com', 'your-password');// Optional: enable debug output during development$client->setDebug(true);
If authentication fails (wrong credentials, network error) the constructor throws an Exception.
3
Register an issuer
Create an Emisor object and register it with VeriFactuAPI. The issuer represents the company that will be submitting invoices.
// Build the issuer object$emisor = $client->nuevoEmisor([ 'nif' => 'A39200019', // Must be a valid Spanish NIF 'nombre' => 'Mi Empresa S.L.', 'enviarAeat' => true, // Auto-submit invoices to AEAT]);// Register the issuer with the API$client->altaEmisor($emisor);
The NIF must be a valid Spanish tax identification number. Invalid NIFs will be rejected by the API.
4
Build the invoice components
A RegistroAlta (invoice registration record) is composed of several objects. At minimum you need an Emisor and a Desglose (tax breakdown).
With setDebug(true), the library prints the Bearer token, object creation confirmations, and API responses to stdout — very useful for verifying your objects are constructed correctly before submitting to AEAT.