Download the PHP package redocmx/client-php without Composer

On this page you can find all versions of the php package redocmx/client-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package client-php

Converting CFDI to PDF

redocmx/client-php

The redocmx/client-php module is a PHP client for interacting with the redoc.mx REST API to convert CFDIs (Comprobante Fiscal Digital por Internet) to PDFs.

This client simplifies the process of sending XML data and retrieving the converted PDF, along with transaction details and metadata.

Requirements

PHP 5.6.0 and later.

Installation

To install the module, run:

To use the bindings, use Composer's autoload:

Usage

First, import the module and create an instance of the Redoc client.

You can optionally pass your API key as an argument, or the client will attempt to load it from the REDOC_API_KEY environment variable.

Converting CFDI to PDF

The redocmx/client-php provides two options for loading CFDI data: from a file or directly from a string.

Option 1: Load XML from the File System

Option 2: Use an XML Content String

Generating the PDF

To convert the loaded CFDI to a PDF:

Examples

API Reference

RedocmxClient

The $redoc object is an instance of RedocmxClient, created using new RedocmxClient(api_key).

Method Description
$redoc->cfdi()->fromFile(filePath) Returns: Cfdi - Instance
Loads file content from the file system for converting a CFDI to PDF. The file should be valid XML for a CFDI.
It returns an instance of the Cfdi class, which can be used to obtain the PDF.
$redoc->cfdi()->fromString(fileContent) Returns: Cfdi - Instance
Uses a CFDI as a string for converting the CFDI to PDF. The string should be valid XML for a CFDI.
It returns an instance of the Cfdi class, which can be used to obtain the PDF.

Cfdi

The $cfdi object is an instance of Cfdi, created using $redoc->cfdi()->fromFile(filePath) or $redoc->cfdi()->fromString(fileContent).

Method Description
$cfdi()->setAddenda(str) Params: String
Allows the use of a redoc addenda for full control over the design of the final PDF.
$cfdi()->toPdf(options) Params: Object - PdfOptions
Returns: Pdf - Instance
An instance of the Pdf class, which, when invoked, converts the CFDI into a PDF and stores it, along with the generated data from the conversion request.
PdfOptions

Pdf

The $pdf object is an instance of Pdf, created from $cfdi->toPdf(options).

Method Description
$pdf->toBuffer() Returns: Buffer
The PDF document as a buffer, ready for storage in the file system or to be sent back in an HTTP request.
$pdf->getTransactionId() Returns: String - UUID
A unique ID for the transaction request to the redoc service.
$pdf->getTotalPages() Returns: Integer
The total number of pages generated for the PDF file.
$pdf->getTotalTimeMs() Returns: Integer
Time in milliseconds taken to convert the CFDI to PDF.
$pdf->getMetadata() Returns: Object - [CfdiMetadata]()
General information from the converted CFDI.
CfdiMetadata

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs, features, or improvements.

License

This project is licensed under the MIT License - see the LICENSE file for details.


All versions of client-php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package redocmx/client-php contains the following files

Loading the files please wait ....