Code Monkey home page Code Monkey logo

zbar-php's Introduction

zbar-php

Latest Version on Packagist GitHub Workflow Status Quality Score Total Downloads

Introduction

zbar-php is a php package that provides an interface to the zbar bar-code reading library.

Requirements

You should have zbar and imagemagick installed.

Installation

You can install the package via composer:

composer require tarfin-labs/zbar-php

Usage

Scanning bar-code or qr-code with zbar is simple.

$zbar = new \TarfinLabs\ZbarPhp\Zbar($imagePath);
$code = $zbar->scan();

Supported file formats: pdf, jpeg, jpg, svg and gif.

Here is how to get only the type of bar code.

$zbar = new \TarfinLabs\ZbarPhp\Zbar($imagePath);
$type = $zbar->type();

echo $type; // "EAN-13"

And this is how you get both.

$zbar = new \TarfinLabs\ZbarPhp\Zbar($imagePath);
$barCode = $zbar->decode();

echo $barCode->code(); // "1234567890128"
echo $barCode->type(); // "EAN-13"

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update the tests as appropriate.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

License

zbar-php is open-sourced software licensed under the MIT license.

zbar-php's People

Contributors

aydinfatih avatar frkcn avatar khalyomede avatar stanbarrows avatar thelastpastor avatar tkaratug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zbar-php's Issues

scan crashes when the output has multiple results

  • zbar-php Package Version: 1.6.0
  • PHP Version: 8.1.19

When scanning an image with multiple barcodes, the zbar returns an array of results. The function scan can't handle it and throws an exception.

Add support for symfony/process ^6.0

Is your feature request related to a problem? Please describe.

To support project that rely on symfony/process:^6.0.

Describe the solution you'd like

Testing with symfony/process ^6.0.

Describe alternatives you've considered

Forking.

Additional context

It's because I use Laravel 9 (which rely on symfony/process:^6.0).

Get the bar code type

Is your feature request related to a problem? Please describe.

I have a feature when the user can input any type of bar code and I do not know it in advance (ean13, code128, ...).

Describe the solution you'd like

Either one will do:

  • The existing "scan" method also returns the type of bar code (breaking change)
  • A new method to get only the type of bar code from the image (not breaking)

Describe alternatives you've considered

None.

Additional context

I will check on the documentation if zbarimg can do it from the command line to give you the exact command to use. Willing to create a pull request if you want.

Add support for PHP 8.2

Is your feature request related to a problem? Please describe.

I will upgrade my projet to 8.2 and would like this package to be installable on 8.2 as well.

Describe the solution you'd like

To support PHP 8.2.

Describe alternatives you've considered

None.

Additional context

I can try to make a pull request (I do not work on the user story yet, but when I work on it I can try to propose a PR for you if you would like).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.