Trying to use a barcode library with Composer and CI4 |
Hi
I could successfuly install (in a CI4 install in subfolder) the following libraries with Composer: dompdf and guzzlehttp Then, I use both in the Controller, etc. Code: ... But I cannot make the same with the following one: https://github.com/picqer/php-barcode-generator I've installed with this Code: composer require picqer/php-barcode-generator Then I use with Code: use Picqer\Barcode; But when I try to use it, CodeIgniter does not find it Code: $generator = new Picqer\Barcode\BarcodeGeneratorPNG(); I've checked the "vendor/composer/autoload_psr4.php" file to see the namespaces. Any suggestions ? Thanks a lot
Enrique
https://beza.com.ar
its also use Exceptions.
So you would also have to load the Exceptions before the other two classes. It's also using Imagick for drawing the barcodes. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(06-26-2020, 03:32 AM)InsiteFX Wrote: its also use Exceptions. Where did you notice/find that? and how do you know that the Exception classes should be load before the others? (06-26-2020, 03:32 AM)InsiteFX Wrote: It's also using Imagick for drawing the barcodes. Yes, I've both with gd correctly setup Thanks again
Enrique
https://beza.com.ar
(06-26-2020, 05:52 AM)Paradinight Wrote: Wow, it was just that ... It worked! Thanks @Paradinight
Enrique
https://beza.com.ar
(06-26-2020, 05:59 AM)kabeza Wrote:(06-26-2020, 05:52 AM)Paradinight Wrote: If you use "use" you can do: use Picqer\Barcode\BarcodeGeneratorPNG; $generator = new BarcodeGeneratorPNG(); or use Picqer\Barcode\BarcodeGeneratorPNG as AnOtherName; $generator = new AnOtherName(); (06-26-2020, 06:19 AM)Paradinight Wrote: If you use "use" you can do: Great! that worked fine. Thanks again for the useful tips
Enrique
https://beza.com.ar
If you look at the barcode class files you will see what they are loading.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |