Generate QR Codes with PHP

Поделиться
HTML-код
  • Опубликовано: 13 июн 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
  • НаукаНаука

Комментарии • 108

  • @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 Год назад +3

      Honestly, this video was just recommended to me by RUclips'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.

  • @jasonhughes638
    @jasonhughes638 Год назад +2

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

  • @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

  • @souravsinha5330
    @souravsinha5330 Год назад +1

    Thank you dave for such a simple explanation.

  • @mhmdbgskr
    @mhmdbgskr 4 месяца назад +1

    A nice and simple tutorial, thanks dave!

  • @edvel9753
    @edvel9753 Год назад

    It's awesome, David. Thanks for sharing!

  • @kurshadqaya1684
    @kurshadqaya1684 Год назад +3

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

  • @randeepyasintha140
    @randeepyasintha140 5 месяцев назад

    Good Tutorial. Thanks for taking your time and putting much effort produce high quality 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!

  • @constantine9074
    @constantine9074 Год назад

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

  • @MrWilliamwright
    @MrWilliamwright Год назад

    Very interesting, Thanks Dave

  • @hillachine3161
    @hillachine3161 Месяц назад

    literatly the best programming video ever

  • @OnyeStephen
    @OnyeStephen Год назад +2

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

  • @ContinuumGaming
    @ContinuumGaming 9 месяцев назад

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

  • @abdelhamidnehlil7277
    @abdelhamidnehlil7277 Год назад +1

    Merci beaucoup ! très bon travail

  • @laszlogyor6628
    @laszlogyor6628 Год назад +1

    Thank you for this video. 👍

  • @wessss1
    @wessss1 Год назад +1

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

  • @earlsamm7421
    @earlsamm7421 Год назад +1

    Excellent lecture

  • @arifsiddikmuharam5830
    @arifsiddikmuharam5830 2 месяца назад +2

    nice thanks sir it works!

  • @user-it4hq2xp1x
    @user-it4hq2xp1x 9 месяцев назад +1

    thank you so much sir, ive appreciate you

  • @michaelkaraim6889
    @michaelkaraim6889 Год назад

    Thanks, this is useful!

  • @KubaSobecki
    @KubaSobecki 24 дня назад

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

  • @williamsa51
    @williamsa51 Год назад +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 🙂

  • @hanymax
    @hanymax Год назад

    you are really brilliant

  • @robertbinkowski
    @robertbinkowski Год назад

    That is amazing!

  • @fraidoonhu9284
    @fraidoonhu9284 Год назад +1

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

  • @danielsalifu1615
    @danielsalifu1615 9 месяцев назад +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  9 месяцев назад

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

  • @kurtbernsteinblancia9536
    @kurtbernsteinblancia9536 2 месяца назад

    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  2 месяца назад

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

  • @mexantos
    @mexantos 10 месяцев назад

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

  • @edwarddoofenschmirtz4436
    @edwarddoofenschmirtz4436 11 месяцев назад

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

    • @dave-hollingworth
      @dave-hollingworth  11 месяцев назад +1

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

  • @RaviMaurya-vo1mk
    @RaviMaurya-vo1mk 5 месяцев назад +1

    Thanku...❤❤

  • @longrolstral
    @longrolstral 27 дней назад +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  27 дней назад +1

      Try this: ruclips.net/video/_WYExkPyYuc/видео.html (and thank you for subscribing!)

    • @longrolstral
      @longrolstral 27 дней назад

      @@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.

  • @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.

  • @szaszattila9406
    @szaszattila9406 8 месяцев назад

    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  8 месяцев назад

      You could process the image afterwards to get rounded corners

  • @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

  • @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.

  • @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

  • @deanbaxter8129
    @deanbaxter8129 4 месяца назад

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

  • @Craxyte
    @Craxyte 10 месяцев назад

    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  10 месяцев назад

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

    • @Craxyte
      @Craxyte 10 месяцев назад +1

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

  • @Mohamed.Saad_IT-uv4hk
    @Mohamed.Saad_IT-uv4hk Месяц назад

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

  • @NeilMohammad
    @NeilMohammad 7 месяцев назад

    will this be usable in visual studio code also?

    • @dave-hollingworth
      @dave-hollingworth  7 месяцев назад

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

  • @user-pz7pq7nf7r
    @user-pz7pq7nf7r 11 месяцев назад

    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 11 месяцев назад +1

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

  • @christianjuliusbonaobra4899
    @christianjuliusbonaobra4899 7 месяцев назад

    I have a question where can I install the composer?

  • @kenaquino3815
    @kenaquino3815 9 месяцев назад

    Hi Dave, how do I make this a unique QR code every time I press the Generate? Thank you!

    • @dave-hollingworth
      @dave-hollingworth  9 месяцев назад

      It depends on the contents - you could add a random string to the end of the content that would change the image; in the case of a URL, so you don't break the URL you could add a random string like this: example.com/?r=abc123

    • @kenaquino3815
      @kenaquino3815 8 месяцев назад

      @@dave-hollingworth Hi Dave, thank you for the quick reply, how do I do this? I'm trying to make a system that will give a unique qr code for every visitor on our school

    • @dave-hollingworth
      @dave-hollingworth  8 месяцев назад

      @@kenaquino3815If you just want a unique string, you can use something like the uniqid function: www.php.net/manual/en/function.uniqid.php

    • @kenaquino3815
      @kenaquino3815 8 месяцев назад +1

      @@dave-hollingworth Thank you so much Dave!

  • @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

  • @DJOZMET
    @DJOZMET Год назад +1

    Great

  • @laptopmaroc1064
    @laptopmaroc1064 4 месяца назад

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

    • @laptopmaroc1064
      @laptopmaroc1064 4 месяца назад

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

    • @dave-hollingworth
      @dave-hollingworth  4 месяца назад

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

    • @laptopmaroc1064
      @laptopmaroc1064 4 месяца назад +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

  • @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 9 месяцев назад

    Does it work with 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 :)

  • @bossjuggy6778
    @bossjuggy6778 9 месяцев назад

    Does it work in php 8.2

  • @AlJapairai
    @AlJapairai 7 месяцев назад

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

    • @dave-hollingworth
      @dave-hollingworth  7 месяцев назад

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

    • @AlJapairai
      @AlJapairai 7 месяцев назад

      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

  • @ademineshat
    @ademineshat Год назад

    👍

  • @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.

  • @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:))

  • @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.