承接 dvdmarchetti/phpbarcode 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dvdmarchetti/phpbarcode

Composer 安装命令:

composer require dvdmarchetti/phpbarcode

包简介

Barcodes in PHP made easy

README 文档

README

Barcode generation made easy

Introduction

Welcome to PHPBarcode generator. This is a PHP class which helps in barcode generation. It offers some barcode formats and options to suit your needs. Read through this documentation file to find out how to install and use the class.

Author note

This project is based on php-barcode project by David Tufts. The original implementation has been made by him. My implementation it's still a work in progress and may present errors. Contributions, issues and questions are always welcome.

Getting Started

Installation

You may install the PHPBarcode Generator with Composer.

$ composer require dvdmarchetti/phpbarcode

Basic Usage

First you have to include the composer-generated autoload file.

<?php require 'vendor/autoload.php'; ?>

Then you can start generating barcodes. You just have to create a new PHPBarcode\Barcode object. PHPBarcode\Barcode's constructor requires at least two parameters:

  • (IBarcodeType) Barcode type (an object which implements PHPBarcode\Type\IBarcodeType interface)
  • (string) Barcode text
  • (optional) (array) Array of dimensions (with width and height index)
  • (optional) (int) Barcode orientation (use class constants)
$barcode = new PHPBarcode\Barcode($type, $text);
$barcode->output();

This will output the image directly in your browser (displayed inline).

Output options

There are three ways of displaying barcodes:

1. Inline Display

Display image directly in browser using built-in image viewer. (NOTE: This method changes Content-Type header to image/png).

Example:

<?php $barcode->output; ?>

2. As Data Url Generate a Base64Data image which can be printed into tags.

Example:

<img src="<?php echo $barcode->outputAsDataUrl(); ?>">

3. Save File Save file as PNG image on server. Path and filename can be specified as parameter.

Example:

<?php $barcode->save('bar.png'); ?>
<img src="bar.png">
<?php
// Without parameter, an unique name will be generated
$filename = $barcode->save();
?>
<img src="<?php echo $filename; ?>">

Documentation

PHPBarcode has a lot of options and customization, but the documentation it's still a work in progress.

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固