barcode icon indicating copy to clipboard operation
barcode copied to clipboard

PHP8 support ?

Open Nuranto opened this issue 3 years ago • 4 comments

Nuranto avatar Jun 20 '22 14:06 Nuranto

I understand the question, but it would be more interesting for me if you could show me error messages. Then I would work on that. Haven't tested it for a long time. Do you have a special application scenario?

AlphaOne89 avatar Jun 20 '22 14:06 AlphaOne89

You're right, I'm sorry.

I don't have it anymore, but the issue was the gd php functions (for example imageline) which are called with floats instead of ints. This triggers a deprecation error.

Nuranto avatar Jun 20 '22 15:06 Nuranto

No strict_types is used in the test file, so barcodes can also be created in PHP version 8. Nothing happened here for a long time, and I don't have that much time to work through everything either. You are more than welcome to send a pull request with improvements.

sample-gd

AlphaOne89 avatar Jun 22 '22 02:06 AlphaOne89

Ok, will do when I got some free time.

Nuranto avatar Jun 22 '22 06:06 Nuranto

Hi there,

I wanted to work on this, but the version I have differs from this repository. I use composer to get this package : https://packagist.org/packages/jbdemonte/barcode, but in fact on packagist it is linked to github.com/lucabartoli/barcode

I'm a bit confused, and don't really know on which project I should work.

Nuranto avatar Sep 05 '22 16:09 Nuranto

On this one, where we are here, is already the right one. The code from "lucabartoli" has good documentation and somehow belongs there, but is very outdated. It seems to me that the wrong origin is stored on packagist.org.

https://barcode-coder.com/en/

AlphaOne89 avatar Sep 05 '22 16:09 AlphaOne89

It also have better PSR implementation (which I do need in my framework). I think I'll just keep using lucabartoli's version for now, and just apply a patch.

Nuranto avatar Sep 05 '22 17:09 Nuranto

I can't understand it, because all things are in the file. And the version of "jbdemonte" supports other programming languages. What is meant by PSR?

  • https://github.com/jbdemonte/barcode/blob/master/php/php-barcode.php
  • https://github.com/lucabartoli/barcode/tree/master/src/JBDemonte/Barcodes

AlphaOne89 avatar Sep 05 '22 17:09 AlphaOne89

Hi @xxalfa

PSR = PHP Standards Recommendations

I use this library in a framework which use PSR-4 standard (most of recent frameworks are) : https://www.php-fig.org/psr/psr-4/

I could make it work with specific autoload mechanisms, but it is very long/unpleasant work to do/maintain. lucabartoli's version does follow PSR-4 and is therefore easier to use in my project.

Nuranto avatar Sep 06 '22 07:09 Nuranto

Of course, now that I'm reading it, it's like the scales fall from my eyes. To my surprise, I found the time and inclination to write a commit. Is it now possible for you to work with the version?

AlphaOne89 avatar Sep 06 '22 10:09 AlphaOne89

Hi @xxalfa,

Yes, if you do the work for PSR-4 and fix packagist, I will be able to work on PHP8 compatibility.

Nuranto avatar Sep 06 '22 11:09 Nuranto

I managed to get packagist ownership jbdemonte/barcode transferred to me and after a few tries finally managed to run the following command composer require jbdemonte/barcode successfully.

AlphaOne89 avatar Sep 07 '22 20:09 AlphaOne89