← Back to list

How to Create EAN Barcodes in PHP

Create EAN barcodes as PNG files with a free API solution. Easily structure your requests with ready-to-run, copy & paste PHP code examples.

Cloudmersive · 2023-03-15 13:21 · 0 claps · 1.2 min read
#ean-13 #ean-8 #barcode-generation-api #php #free-api
Open on Medium ↗

How to Create EAN Barcodes in PHP

A simple EAN barcode API solution might become a critical factor in scaling your ecommerce business. Thankfully, you can generate both EAN-13 and EAN-8 barcodes with ease using the PHP code examples provided in this article, and you can do so for free with a free-tier API key (get one by registering a free account on our website; this comes with 800 API calls per month and zero commitments).

First, run this command to install the PHP SDK:

composer require cloudmersive/cloudmersive_barcode_api_client

After that, use the below code to create EAN-13 barcodes as PNG files:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Apikey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Apikey', 'YOUR_API_KEY');

$apiInstance = new Swagger\Client\Api\GenerateBarcodeApi(


    new GuzzleHttp\Client(),
    $config
);
$value = "value_example"; // string | Barcode value to generate from

try {
    $result = $apiInstance->generateBarcodeEAN13($value);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling GenerateBarcodeApi->generateBarcodeEAN13: ', $e->getMessage(), PHP_EOL;
}
?>

Or use the final code examples below to create EAN-8 barcodes as PNG files:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Apikey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Apikey', 'YOUR_API_KEY');

$apiInstance = new Swagger\Client\Api\GenerateBarcodeApi(


    new GuzzleHttp\Client(),
    $config
);
$value = "value_example"; // string | Barcode value to generate from

try {
    $result = $apiInstance->generateBarcodeEAN8($value);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling GenerateBarcodeApi->generateBarcodeEAN8: ', $e->getMessage(), PHP_EOL;
}
?>

If your barcode generation needs begin to exceed the 800 free API call monthly limit, you can easily upgrade to an enterprise plan through your account page. Simple & easy.


메타데이터
post_id
60b79ebe17d4
slug
how-to-create-ean-barcodes-in-php-60b79ebe17d4
url
https://medium.com/@cloudmersive/how-to-create-ean-barcodes-in-php-60b79ebe17d4
canonical_url
https://medium.com/@cloudmersive/how-to-create-ean-barcodes-in-php-60b79ebe17d4
author_url
https://medium.com/@cloudmersive
status
ok
fetched_at
2026-07-26 00:50:03