aspose / barcode-cloud-php
Aspose.BarCode for Cloud is a REST API for Linear, 2D and postal barcode generation and recognition in the cloud. API recognizes and generates barcode images in a variety of formats. Barcode REST API allows to specify barcode image attributes like image width, height, border style and output image f
Package info
github.com/aspose-barcode-cloud/Aspose.BarCode-Cloud-SDK-for-PHP
pkg:composer/aspose/barcode-cloud-php
Requires
- php: >=8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.4
Requires (Dev)
- friendsofphp/php-cs-fixer: >=2.16
- phpstan/phpstan: ^1.9
- phpunit/phpunit: >=10.0
This package is auto-updated.
Last update: 2026-06-30 13:34:27 UTC
README
- API version: 4.0
- Package version: 26.6.0
- Supported PHP versions: ">=8.0"
SDK and API Version Compatibility:
- SDK Version 25.1 and Later: Starting from SDK version 25.1, all subsequent versions are compatible with API Version v4.0.
- SDK Version 24.12 and Earlier: These versions are compatible with API Version v3.0.
Demo applications
| Scan QR | Generate Barcode | Recognize Barcode |
|---|---|---|
| Generate Wi-Fi QR | Embed Barcode | Scan Barcode |
Aspose.BarCode for Cloud is a REST API for Linear, 2D and postal barcode generation and recognition in the cloud. API recognizes and generates barcode images in a variety of formats. Barcode REST API allows to specify barcode image attributes like image width, height, border style and output image format in order to customize the generation process. Developers can also specify the barcode type and text attributes such as text location and font styles in order to suit the application requirements.
This repository contains Aspose.BarCode Cloud SDK for PHP source code.
To use these SDKs, you will need Client Id and Client Secret which can be looked up at Aspose Cloud Dashboard (free registration in Aspose Cloud is required for this).
How to use the SDK
You can either directly use it in your project via source code or get Packagist distribution (recommended).
AI Agent Skills
This repository includes an AI-agent skill in skills/generate-and-scan-barcode-php/SKILL.md. Point your coding agent to it when working with this SDK so it follows the repo workflow and SDK-specific API patterns.
Installation
Via Composer
barcode-cloud-php is available on Packagist as the
barcode-cloud-php package. Run the following command:
composer require aspose/barcode-cloud-php
To use the SDK, use Composer's autoload:
require __DIR__ . '/vendor/autoload.php';
Sample usage
<?php declare(strict_types=1); require __DIR__ . '/vendor/autoload.php'; use Aspose\BarCode\Configuration; use Aspose\BarCode\GenerateApi; use Aspose\BarCode\Requests\GenerateRequestWrapper; use Aspose\BarCode\Model\{BarcodeImageParams, EncodeBarcodeType, EncodeDataType, CodeLocation, BarcodeImageFormat, QrParams, QREncodeMode, QRErrorLevel, QRVersion}; $config = new Configuration(); $config->setClientId('ClientId from https://dashboard.aspose.cloud/applications'); $config->setClientSecret('Client Secret from https://dashboard.aspose.cloud/applications'); if (getenv("TEST_CONFIGURATION_ACCESS_TOKEN")) { $config->setAccessToken(getenv("TEST_CONFIGURATION_ACCESS_TOKEN")); } $request = new GenerateRequestWrapper(EncodeBarcodeType::QR, 'PHP SDK Test'); $request->barcode_image_params = new BarcodeImageParams(); $request->barcode_image_params->setImageFormat(BarcodeImageFormat::Png); $request->barcode_image_params->setTextLocation(CodeLocation::None); $request->qr_params = new QrParams(); $request->qr_params->setQrEncodeMode(QREncodeMode::Auto); $request->qr_params->setQrErrorLevel(QRErrorLevel::LevelM); $request->qr_params->setQrVersion(QRVersion::Auto); $request->qr_params->setQrAspectRatio(0.75); $api = new GenerateApi(null, $config); $response = $api->generate($request); $type = 'image/png'; $size = $response->getSize(); header("Content-Type: $type"); header("Content-Length: $size"); echo $response->fread($size);
Licensing
All Aspose.BarCode for Cloud SDKs, helper scripts and templates are licensed under MIT License.
Resources
Documentation for API Endpoints
All URIs are relative to https://api.aspose.cloud/v4.0
| Class | Method | HTTP request | Description |
|---|---|---|---|
| GenerateApi | generate | GET /barcode/generate/{barcodeType} | Generate a barcode using a GET request with parameters in the route and query string. |
| GenerateApi | generateBody | POST /barcode/generate-body | Generate a barcode using a POST request with parameters in the request body in JSON or XML format. |
| GenerateApi | generateMultipart | POST /barcode/generate-multipart | Generate a barcode using a POST request with parameters in a multipart form. |
| RecognizeApi | recognize | GET /barcode/recognize | Recognize a barcode from a file on an Internet server using a GET request with a query string parameter. For recognizing files from your hard drive, use `recognize-body` or `recognize-multipart` endpoints instead. |
| RecognizeApi | recognizeBase64 | POST /barcode/recognize-body | Recognize a barcode from a file in the request body using a POST request with JSON or XML body parameters. |
| RecognizeApi | recognizeMultipart | POST /barcode/recognize-multipart | Recognize a barcode from a file in the request body using a POST request with multipart form parameters. |
| ScanApi | scan | GET /barcode/scan | Scan a barcode from a file on an Internet server using a GET request with a query string parameter. For scanning files from your hard drive, use `scan-body` or `scan-multipart` endpoints instead. |
| ScanApi | scanBase64 | POST /barcode/scan-body | Scan a barcode from a file in the request body using a POST request with a JSON or XML body parameter. |
| ScanApi | scanMultipart | POST /barcode/scan-multipart | Scan a barcode from a file in the request body using a POST request with a multipart form parameter. |
Documentation For Models
- ApiError
- ApiErrorResponse
- BarcodeImageFormat
- BarcodeImageParams
- BarcodeResponse
- BarcodeResponseList
- Code128EncodeMode
- Code128Params
- CodeLocation
- DecodeBarcodeType
- ECIEncodings
- EncodeBarcodeType
- EncodeData
- EncodeDataType
- GenerateParams
- GraphicsUnit
- MacroCharacter
- MicroQRVersion
- Pdf417EncodeMode
- Pdf417ErrorLevel
- Pdf417Params
- QREncodeMode
- QRErrorLevel
- QRVersion
- QrParams
- RecognitionImageKind
- RecognitionMode
- RecognizeBase64Request
- RectMicroQRVersion
- RegionPoint
- ScanBase64Request