Generate QR Codes with PHP

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ส.ค. 2024
  • Please consider supporting my channel:
    ☕ ko-fi.com/davehollingworth
    Learn how to generate a QR code using PHP.
    QR codes are two dimensional barcodes that can hold up to 2000 characters of text. Depending on the content, when you scan a QR code they can simply display the text they contain; open a browser at a specific URL, call a phone number and so on.
    In the context of a web application, you might want to use them to link to an online invoice, a unique code for a ticket to gain entry to an event, a location on a map and so on.
    Full PHP course:
    ➤ davehollingworth.net/phpy
    In this video you'll learn:
    • the basics of generating a QR code using PHP
    • changing the colour and size
    • adding labels and watermark images
    • setting error correction levels
    • outputting the QR code as a PNG image
    • saving the image to a file on the server
    Code shown in the video:
    ‣ gist.github.com/daveh/c63af8c...
    Endroid QR-Code package:
    ‣ github.com/endroid/qr-code
    WikiPedia QR Code:
    en.wikipedia.org/wiki/QR_code
    CSS:
    ‣ watercss.kognise.dev/
    00:00 Introduction
    00:50 Install package
    01:18 Create a QR code
    02:05 Set size and margin
    03:32 Change colours
    04:19 Add a label
    05:10 Change label colour
    05:34 Change label alignment
    06:04 Add a logo
    06:51 Resize the logo
    07:09 Readability
    07:38 Set the error correction level
    08:15 Save to a local file
    09:23 Summary
    #PHP #qrcode
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 105

  • @dave-hollingworth
    @dave-hollingworth  ปีที่แล้ว +9

    Out of interest, why do you want to generate a QR code in PHP?

    • @mohammedabdulkadir372
      @mohammedabdulkadir372 ปีที่แล้ว +1

      Can you do a file streaming (copying a file from one server to another as a post )tutorial using php and Guzzle

    • @techzacharyzn6296
      @techzacharyzn6296 ปีที่แล้ว +4

      Honestly, this video was just recommended to me by TH-cam's hIgH-tIeRer algorithm. But seriously, this is a very well-made video that isn't getting enough attention.

    • @mohammedabdulkadir372
      @mohammedabdulkadir372 ปีที่แล้ว

      @techzacharyzn6296 It takes time for programming vids to get views.

    • @tristanjayvirtudazo2268
      @tristanjayvirtudazo2268 ปีที่แล้ว

      It's quite hassle if you call an API to generate the QRCode when you can make it inside the app.

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      @@tristanjayvirtudazo2268 Just to clarify, the video uses a third-party package to generate the QR code, not an API - the package is installed inside the application code.

  • @joshuaprogron1562
    @joshuaprogron1562 ปีที่แล้ว +1

    This is crazy ... I never knew I could do this in PHP ... I thought it was only JavaScript that I could use to do Qr codes... Man you're on another level of PHP... And also your tutorials are way too awesome, simple, concise and beginner friendly

  • @jasonhughes638
    @jasonhughes638 ปีที่แล้ว +2

    Your tutorials are incredibly clear and well explained. Thank you, Dave.

  • @souravsinha5330
    @souravsinha5330 ปีที่แล้ว +1

    Thank you dave for such a simple explanation.

  • @mhmdbgskr
    @mhmdbgskr 6 หลายเดือนก่อน +1

    A nice and simple tutorial, thanks dave!

  • @kurshadqaya1684
    @kurshadqaya1684 ปีที่แล้ว +3

    Dave, as always your explanation is amazing!
    I expect more courses from you in Udemy related to more Senior PHP content.

  • @gru8299
    @gru8299 ปีที่แล้ว +1

    To find a job as a web developer, I think it will come in handy at the interview, and of course in future work. Thank you very much for your work!

  • @edvel9753
    @edvel9753 ปีที่แล้ว

    It's awesome, David. Thanks for sharing!

  • @constantine9074
    @constantine9074 ปีที่แล้ว

    hello Dave, thank you for awesome content, really looking forward for more videos like this

  • @randeepyasintha140
    @randeepyasintha140 6 หลายเดือนก่อน

    Good Tutorial. Thanks for taking your time and putting much effort produce high quality content.

  • @MrWilliamwright
    @MrWilliamwright ปีที่แล้ว

    Very interesting, Thanks Dave

  • @OnyeStephen
    @OnyeStephen ปีที่แล้ว +2

    Awesome videos I wish you can start making videos about Object Oriented PHP, I love how you explain things

  • @hillachine3161
    @hillachine3161 2 หลายเดือนก่อน

    literatly the best programming video ever

  • @laszlogyor6628
    @laszlogyor6628 ปีที่แล้ว +1

    Thank you for this video. 👍

  • @arifsiddikmuharam5830
    @arifsiddikmuharam5830 4 หลายเดือนก่อน +2

    nice thanks sir it works!

  • @abdelhamidnehlil7277
    @abdelhamidnehlil7277 ปีที่แล้ว +1

    Merci beaucoup ! très bon travail

  • @earlsamm7421
    @earlsamm7421 ปีที่แล้ว +1

    Excellent lecture

  • @michaelkaraim6889
    @michaelkaraim6889 ปีที่แล้ว

    Thanks, this is useful!

  • @KubaSobecki
    @KubaSobecki 2 หลายเดือนก่อน

    What an amazingly valuable content. Insta sub. Thank you!

  • @ContinuumGaming
    @ContinuumGaming 11 หลายเดือนก่อน

    I am impressed the moment you do not just use a library but show us how to write the algorithm...

  • @user-it4hq2xp1x
    @user-it4hq2xp1x 10 หลายเดือนก่อน +1

    thank you so much sir, ive appreciate you

  • @robertbinkowski
    @robertbinkowski ปีที่แล้ว

    That is amazing!

  • @wessss1
    @wessss1 ปีที่แล้ว +1

    Thank you for your easy and professional tutorials.
    Can you make one about PHP and LDAP????

  • @hanymax
    @hanymax ปีที่แล้ว

    you are really brilliant

  • @RaviMaurya-vo1mk
    @RaviMaurya-vo1mk 6 หลายเดือนก่อน +1

    Thanku...❤❤

  • @kurtbernsteinblancia9536
    @kurtbernsteinblancia9536 4 หลายเดือนก่อน

    hi Sir, on this encoder side of the qr, how do i make a decoding in my project? do i have to use composer to install another package?

    • @dave-hollingworth
      @dave-hollingworth  4 หลายเดือนก่อน

      Yes, there are several packages here: packagist.org/?query=decode%20qr

  • @alan-overthenet
    @alan-overthenet ปีที่แล้ว +2

    Hi Dave, thank you for the continued content. I have no need to generate a QR code but I like to follow your content as I find it valuable.
    Do you have anymore Udemy course planned?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว +2

      Thank you for your kind words Alan! Currently working on rewriting my PHP MVC course, I hope to have it ready soon 🙂

  • @Yocedskull
    @Yocedskull ปีที่แล้ว

    Hey!, what if i need to upload that qr-image or i will want to use in a database?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      The video covers how to save the image to a file at time index 8:15

  • @szaszattila9406
    @szaszattila9406 10 หลายเดือนก่อน

    how can i make rounded cornders of a qrcode?
    and can i make the logo background free, or add some margin to the logo

    • @dave-hollingworth
      @dave-hollingworth  10 หลายเดือนก่อน

      You could process the image afterwards to get rounded corners

  • @danielsalifu1615
    @danielsalifu1615 11 หลายเดือนก่อน +1

    This is great tutorial. Thanks for sharing. Do you have any video that explains how to scan the QR code?

    • @dave-hollingworth
      @dave-hollingworth  11 หลายเดือนก่อน

      Not at the moment, but I might do a video about this in the future if I get chance.

  • @fraidoonhu9284
    @fraidoonhu9284 ปีที่แล้ว +1

    Great thanks. One can create QR code for e-invoice

  • @NeilMohammad
    @NeilMohammad 9 หลายเดือนก่อน

    will this be usable in visual studio code also?

    • @dave-hollingworth
      @dave-hollingworth  9 หลายเดือนก่อน

      Not sure I know what you mean - the editor I use in the video is Visual Studio Code

  • @christianjuliusbonaobra4899
    @christianjuliusbonaobra4899 9 หลายเดือนก่อน

    I have a question where can I install the composer?

    • @dave-hollingworth
      @dave-hollingworth  9 หลายเดือนก่อน

      Installation instructions at getcomposer.org/

  • @AquaBlazt
    @AquaBlazt ปีที่แล้ว

    Hello David, I'm following your PHP for beginners course on Udemy but do you now why it appears on draft mode? yesterday I had access to it but today It changed to draft mode.

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว +1

      Thank you for letting me know - Udemy tell me this was a technical fault, but it's fixed now - if you still get a problem, please let me know. Thanks!

    • @AquaBlazt
      @AquaBlazt ปีที่แล้ว

      ​@@dave-hollingworth Thanks! now all is working and I don't have any problems.

  • @emmanuelterdoomzer6309
    @emmanuelterdoomzer6309 ปีที่แล้ว

    Thank you Dave. You are an awesome teacher. But please can you do a tutorial that teaches how to build REST APIS in Codeigniter 4 using JWT? Seen some tutorials, but they are not so great. I recently bought you CI4 tutorial on Udemy.

  • @edwarddoofenschmirtz4436
    @edwarddoofenschmirtz4436 ปีที่แล้ว

    great vid, really useful. Do you have a video for QR reading?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว +1

      Not at the moment I'm afraid, but it's on my list!

  • @mexantos
    @mexantos ปีที่แล้ว

    We need more PHP tuts from intermediate to advanced level like this. btw how to implement login to PHP app using QR Code

  • @deanbaxter8129
    @deanbaxter8129 6 หลายเดือนก่อน

    i just get errors when trying to do the composer stage.....

  • @user-pz7pq7nf7r
    @user-pz7pq7nf7r ปีที่แล้ว

    Hello Dave, this worked perfectly with my Xamp, but it was blank when I uploaded it on live server. Please assist me

    • @user-pz7pq7nf7r
      @user-pz7pq7nf7r ปีที่แล้ว +1

      Pardon me, It because of the PHP version of the server, I upgraded it and it worked. Thanks

  • @DJOZMET
    @DJOZMET ปีที่แล้ว +1

    Great

  • @bossjuggy6778
    @bossjuggy6778 10 หลายเดือนก่อน

    Does it work with php 8.2?

  • @Craxyte
    @Craxyte ปีที่แล้ว

    Hi, great Video! But is it possible to change the size, color etc. in a HTML Form in the form.php and not in the code?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      Absolutely, just create form input elements that provide those values then use those when setting the properties

    • @Craxyte
      @Craxyte ปีที่แล้ว +1

      @@dave-hollingworth Thank you for the quick response. I will try it out!

  • @thelostvorg7805
    @thelostvorg7805 25 วันที่ผ่านมา

    the scanned qrCode result is just plain text , how to make it clickable like a url ?

    • @dave-hollingworth
      @dave-hollingworth  25 วันที่ผ่านมา +1

      Depends on the client you use to read the code - if it's a properly formed URL, some clients open this directly in a browser

  • @Mohamed.Saad_IT-uv4hk
    @Mohamed.Saad_IT-uv4hk 3 หลายเดือนก่อน

    Class "Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh" not found

  • @laptopmaroc1064
    @laptopmaroc1064 6 หลายเดือนก่อน

    please help when i try to install qr code package with composer its show error !! dont know why

    • @laptopmaroc1064
      @laptopmaroc1064 6 หลายเดือนก่อน

      text error = failed to download dasprid/enum from dist: the zip extension and unzib/7z commands are both missing

    • @dave-hollingworth
      @dave-hollingworth  6 หลายเดือนก่อน

      @@laptopmaroc1064Looks like you need to install the PHP zip and 7z extensions

    • @laptopmaroc1064
      @laptopmaroc1064 6 หลายเดือนก่อน +1

      @@dave-hollingworth thank you very much your answer solved the problem for me

  • @pacificexperience
    @pacificexperience ปีที่แล้ว

    Show me how to create Admin Panel

  • @sinitquenapach5497
    @sinitquenapach5497 ปีที่แล้ว

    Any discount your course Udemy PHP rest API

  • @salamaslam
    @salamaslam ปีที่แล้ว

    Thanks, it's really informative, can you please share details on how I can add an image to the description?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว +1

      There's a link in the description to the official documentation: github.com/endroid/qr-code

    • @salamaslam
      @salamaslam ปีที่แล้ว +1

      @@dave-hollingworth Thanks Dave

  • @longrolstral
    @longrolstral 2 หลายเดือนก่อน +1

    Thank you for this. I got as far as the header, but I received the error that headers have already been set, and I could not proceed that way.
    I've subscribed. Thank you.

    • @dave-hollingworth
      @dave-hollingworth  2 หลายเดือนก่อน +1

      Try this: th-cam.com/video/_WYExkPyYuc/w-d-xo.html (and thank you for subscribing!)

    • @longrolstral
      @longrolstral 2 หลายเดือนก่อน

      @@dave-hollingworth Thank you very much. Such a small thing but a massive need-to-know.
      In the end, I decided to save the QR code as a file, and then insert the URI path into my database.

  • @user-gh9fp3wt1m
    @user-gh9fp3wt1m ปีที่แล้ว

    I am getting this error
    Fatal error: Uncaught Exception: Unable to generate image: please check if the GD extension is enabled and configured correctly in C:\xampp\htdocs\TestMail\vendor\endroid\qr-code\src\Writer\AbstractGdWriter.php:26 Stack trace: #0 C:\xampp\htdocs\TestMail\vendor\endroid\qr-code\src\Writer\PngWriter.php(25): Endroid\QrCode\Writer\AbstractGdWriter->write(Object(Endroid\QrCode\QrCode), NULL, Object(Endroid\QrCode\Label\Label), Array) #1 C:\xampp\htdocs\TestMail\generate.php(29): Endroid\QrCode\Writer\PngWriter->write(Object(Endroid\QrCode\QrCode), NULL, Object(Endroid\QrCode\Label\Label)) #2 {main} thrown in C:\xampp\htdocs\TestMail\vendor\endroid\qr-code\src\Writer\AbstractGdWriter.php on line 26

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      You need to install / enable the PHP GD extension - www.google.co.uk/search?q=install+php+gd+extension

  • @sinitquenapach5497
    @sinitquenapach5497 ปีที่แล้ว

    Hello is there discount your API course on Udemy

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      You can use this link, it expires in 2 days: www.udemy.com/course/php-apis/?couponCode=APRIL2023

  • @bossjuggy6778
    @bossjuggy6778 10 หลายเดือนก่อน

    Does it work in php 8.2

  • @klexxsy
    @klexxsy ปีที่แล้ว

    Hello my friend, could you do a tutorial about a follow/unfollow system? Thanks very much

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      Thank you for the idea, I'll put it on my list!

    • @klexxsy
      @klexxsy ปีที่แล้ว +1

      @@dave-hollingworth thank you :)

  • @cabdicasiissaleebaan4215
    @cabdicasiissaleebaan4215 ปีที่แล้ว

    i have $16 and i need your course rest api please can it be reduced to $16 dollars

    • @souravsinha5330
      @souravsinha5330 ปีที่แล้ว

      You can learns it free from youtube. Else ping me anyway.

  • @AlJapairai
    @AlJapairai 9 หลายเดือนก่อน

    Well now the code is not working because the "endroid" package changed

    • @dave-hollingworth
      @dave-hollingworth  9 หลายเดือนก่อน

      Please can you be more specific? In what way isn't it working, do you get any error messages?

    • @AlJapairai
      @AlJapairai 9 หลายเดือนก่อน

      I'm sorry I wasn't clear with my comment, your code works great actually, the not working part is the package, I get this message "Fatal error: Call to undefined function: imagecreate()"@@dave-hollingworth

  • @hichamizem3462
    @hichamizem3462 ปีที่แล้ว +1

    when are you gonna change profile picture?

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว

      Interesting question! Why do you think I need to change the profile picture?

    • @hichamizem3462
      @hichamizem3462 ปีที่แล้ว

      Because it's always the same and in your thumbnail too. It makes me nervous.

    • @dave-hollingworth
      @dave-hollingworth  ปีที่แล้ว +1

      @@hichamizem3462 Er, ok... well I have been meaning to change it for some time anyway, so I will be changing it soon!

    • @hichamizem3462
      @hichamizem3462 ปีที่แล้ว

      @@dave-hollingworth I really like your new profile ! The smile is giving a really good vibe to your youtube account.

    • @bloody_shurik4n210
      @bloody_shurik4n210 ปีที่แล้ว

      Wow it really seems better now, congratulations:))

  • @ademineshat
    @ademineshat ปีที่แล้ว

    👍

  • @emmanuelterdoomzer6309
    @emmanuelterdoomzer6309 ปีที่แล้ว

    Thank you Dave. You are an awesome teacher. But please can you do a tutorial that teaches how to build REST APIS in Codeigniter 4 using JWT? Seen some tutorials, but they are not so great. I recently bought you CI4 tutorial on Udemy.