Download the PHP package pedroquezado/correios without Composer

On this page you can find all versions of the php package pedroquezado/correios. 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 correios

Correios API Client - PedroQuezado

Maintainer Source Code PHP from Packagist Latest Version Build Quality Score Total Downloads

Introduction

This package provides an easy-to-use PHP client for interacting with the Correios API. It allows you to fetch pricing and delivery times for different products offered by Correios.

Installation

First, you need to add the package to your project using Composer.

Usage

Initialize the Client

To initialize the Cliente class, you need to provide your Correios API credentials (username and password), the card number, and an optional fourth parameter to specify the environment (production or homologation). By default, the client uses the production environment.

Example

Adding Products

The inserirProduto method allows you to add products to the client for further operations, such as price and delivery time calculations. The method accepts two parameters: $coProduto and an array $arrProduto containing the product details.

Parameters

Example

Importance in Other Methods

The $coProduto parameter is essential for the consultarPrecoTotal and consultarPrazoTotal methods. These methods use $coProduto to filter and calculate the total price or delivery time for the specified product type. By organizing products with $coProduto, you can easily manage and retrieve detailed information for specific product types.

Fetching Prices

You can fetch the prices for the added products using the consultarPreco method.

Fetching Delivery Time

The consultarPrazo method allows you to calculate the delivery time for your products. It takes four parameters:

  1. $dataPostagem: The posting date in the format YYYY-MM-DD.
  2. $cepOrigem: The origin postal code.
  3. $cepDestino: The destination postal code.
  4. $dtEvento: (Optional) The event date in the format DD-MM-YYYY. If not provided, it defaults to the posting date converted to the required format.

Example

Parameters Explanation

By calling consultarPrazo, you can obtain the estimated delivery time and other related information for each product you have added. The method returns detailed delivery time information, which can be used to inform customers about their expected delivery dates.

Fetching Total Price

You can fetch the total price for a specific product code using the consultarPrecoTotal method.

Fetching Total Delivery Time

You can fetch the total delivery time for a specific product code using the consultarPrazoTotal method.

Exception Handling

All exceptions are handled using the ClienteException class. This class provides additional information such as the HTTP code and the response from the API.

Documentation

For more detailed information, please refer to the official Correios API documentation:

Conclusion

This package simplifies the process of interacting with the Correios API by providing a structured and easy-to-use client. It supports fetching prices and delivery times for various products, handling authentication, and providing detailed error handling.


All versions of correios with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.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 pedroquezado/correios contains the following files

Loading the files please wait ...