picqer / php-barcode-generator

Barcode generator in PHP that is easy to use, non-bloated and framework independent.
GNU Lesser General Public License v3.0
1.66k stars 400 forks source link

No dependencies? #200

Closed marksch closed 4 months ago

marksch commented 4 months ago

The main page of this projecct (ReadMe) says no lirbaries and other dependencies are involved and yet, when I run generate-examples.php I see the following error:

Fatal error: Uncaught Error: Class 'PHPUnit\Framework\TestCase' not found in C:\Users***\Server\barcode\tests\BarcodeHtmlTest.php:5 Stack trace: #0 {main} thrown in C:\Users***\Server\barcode\tests\BarcodeHtmlTest.php on line 5

Apparently, this project depends on a framework.

casperbakker commented 4 months ago

I don't think the tone of your message is helpful.

But anyway, the file is not part of the barcode generation library. It is only to generate the examples for the tests and for the documentation, like the name suggests... The generator script is if we add new formats or change the output, we can quickly recreate all examples.

The generated examples can be seen here: https://github.com/picqer/php-barcode-generator/blob/main/examples.md

The library in this project does not use anything, apart from GD or Imagick for JPG/PNG. As you can see in the composer.json.

marksch commented 4 months ago

I didn't intend to use a specific tone.

Your reply doesn't explain why the script doesn't work. The following should generate a barcode, but it doesn't. Why not?

<html>
<head>
<script src="https://unpkg.com/jsbarcode@latest/dist/JsBarcode.all.min.js"></script>
</head>
<body>
<svg id="barcode"
  jsbarcode-format="upc"
  jsbarcode-value="123456789012"
  jsbarcode-textmargin="0"
  jsbarcode-fontoptions="bold">
</svg><script>
  JsBarcode("#barcode");
</script>
</body>
</html>
casperbakker commented 4 months ago

That JS code has nothing to do with this package.

If you use this PHP library, you don't need the generate-examples.php. How it does work is explained in https://github.com/picqer/php-barcode-generator/blob/main/Readme.md

marksch commented 4 months ago

I suggest you make that clear in the description of your project. I have downloaded JSBarcode from somewhere else and now it works perfectly.

casperbakker commented 4 months ago

I suggest you read the docs already there. I also suggest you don't run arbitrary code on your machine without knowing what you run or how it works.