Thank you for putting this together. I've looked online specifically for practical PHP examples and struggled to find anything of use. This video, like all of yours, is very helpful.
I got caught up with practicing this lesson. I made up my own invoice data and added some classes, some code and uploaded the values in a new table in the database so as to work together with the exercise you gave at the end of section 2. It was a great experience. I'm amazed at how much this course has thought me. Thanks Gio. The Enums feature seems really cool. I'm pleased to be learning PHP8. It makes me think that the much older versions may have been tougher to work with. lol. Thanks again Gio.
Fantastic topic and fantastic teaching! Thank you Gio! @23:14 You mention the first parameter of Router->register given as Enum object and change it to be string as the register method deserves it. I wonder why you change this at this spot? I instead passed through the Enum object here as well and change the register function to accept the HttpMethod object as I am able to get rid of the other hardcoded attributes inside get() and post() methods as well.
Before we had 'Enums', I would use an interface as you can have defined 'const' in them. It made them readable and easy to find in code. Obviously, 'Enums' are a more complete solution. Thanks for explaining. Appreciated.
At timestamp 24:32, VS code highlights the self::Paid and others as "Undefined Class Constant". Though the app works fine though not sure why the errors?
Yea that's fine because the constants are not defined in trait they are defined in a class that uses that trait. VSCode is not a full IDE so it cant trace it back properly which is why it highlights it. PHPStorm is able to trace it and thats why it does not underline it.
@@ProgramWithGio Fantastic, I have also referred this problem to the developers of the Php Intelephense extension which i have a paid license. Lets see what we get back.
Gio, i am puzzled with the new problem is am facing at timestamp 26:39. When i enter url as "localhost:8000/invoices" everything works fine but when i enter the url as "localhost:8000/invoices/" it goes into error page. Is there a reason for this?
By default, Nginx treats URLs with and without trailing slashes as separate locations. You would need to modify the nginx config to handle trailing slashes if you need that
@@ProgramWithGio I am using the PHP built-in server and same happens. Alternative, I resolved it coding 2 Get attributes in InvoiceController to cater for both scenarios and it works fine. Thank you so much.
How you organize enums? We use database table for something similar, because there are more then 1000 “constants” in unique groups > group = enum. I don’t think would be wise to create 200 files with enums.
It depends on the structure for sure, if you have that many enums then maybe a different strategy is better like storing in database. For example, you wouldnt store country codes as constants but instead store them in database
Hello, I need help, I'm working with an Enum: Error_Code: int and trying to create an error output with another Enum_Code_De: string. I'm sure it should work, I just can't figure out how. Maybe as a topic for another tutorial
Thank you for this amazing course! I've some questions tho. How advanced are we if made it to this video of the course? When do you think this course will be over? I definitely would've paid to get a complete course from you, your explainations are simple and concise. Again thanks !
There are more topics I want to cover before we end the series & there is also a project towards the end. Getting through this course is good & will give you the good foundation but you need to practice & apply the knowledge by working on projects, otherwise it will fade away. That's why we'll work on a project towards the end
Gio, the Github contains the finished code for the end of the video. It is a bit difficult to copy/paste the code when I am in the middle of the video. I am all excited with the course but this is slowing down my progress.
Yes the code in branches are complete codes for the lesson. The project that we work on at the end has 2 branches for each lesson the start & the end so that way you can choose which one you want to use. The source in the repo for these lessons are not meant to be copy/pasted, its there to see/reference the final code for the lesson. You should write the code as you are watching the video. The code is usually the same as previous lessons, so just continue from where you left off before and if a file is missing then you can check the final code for the lesson and add it in. I know its not the most efficient way but that's the best I could do for that time. With the project its a bit easier given that it has 2 branches per lesson.
thank you for the response, you did not get my point, i am trying to load enum dynamically, i have a string name of enum class ,but can not call tryfrom on string..
@@rahulchavan. yes you can if your enum is backed enum and is type string. Maybe I'm not understanding the question properly. Maybe if you share an example code I could better understand
say for example , i have ten's of enum class ,and i have fqcn of each class, i would like to load enum dynamically, if i know which enum to load i would do enum::tryfrom, but i can not do (fqcn)::tryfrom because fcqn is just a string.sorry if this is confusing or not able to make you understand.
@@rahulchavan. I think I understand, you should be able to do it by storing the enum class name in a variable & call methods on it like $enum = 'YourEnum'; and then $enum::tryfrom() that should work, have you tried it? Do you get any errors?
Sir, how to run Async functions and background jobs. You are doing a great job. It's great to have all required things together in a correct way. How to usewhen to use what!! Please try to cover reportinv in php also!
@@ProgramWithGio feels great to get a reply! I am more concern about the async calls, when UI gets stuck I need to implement something like async calls within Php. I never worked on reporting part in php. Is there open source tool for database reporting like BI reports
Thank you for putting this together. I've looked online specifically for practical PHP examples and struggled to find anything of use. This video, like all of yours, is very helpful.
You're very welcome! Glad it was helpful.
I got caught up with practicing this lesson. I made up my own invoice data and added some classes, some code and uploaded the values in a new table in the database so as to work together with the exercise you gave at the end of section 2. It was a great experience. I'm amazed at how much this course has thought me. Thanks Gio. The Enums feature seems really cool. I'm pleased to be learning PHP8. It makes me think that the much older versions may have been tougher to work with. lol. Thanks again Gio.
For sure, PHP is getting better & better with each new version
Love seeiythe quality of your videos just keep going up and up!
Thank you Dan 💙💙
Fantastic topic and fantastic teaching! Thank you Gio!
@23:14 You mention the first parameter of Router->register given as Enum object and change it to be string as the register method deserves it. I wonder why you change this at this spot? I instead passed through the Enum object here as well and change the register function to accept the HttpMethod object as I am able to get rid of the other hardcoded attributes inside get() and post() methods as well.
Yup you can do that as well, I just did not bother doing a lot of refactoring.
Thanks for another great lesson, at 14:28 after creating an enum case object using tryFrom, can't we just acccess the name property and display it?
Yes but name will not always be something user friendly
I really love your video's i have really struggled with the exact use case for enum but you just made it very simple
Great to hear, thank you
Great and very helpful video as always! Thanks!
Thank you 🙌
love your explanation always 😍
Thank you 🙌
I wish I have started php with this tutorial... really profound with great examples and explanations
Glad you like it, thank you 💙
Huge amount of information, thanks for everything ❤
You're welcome 💙
Really insightful. Thank you a lot. I can't even imagine how much effort you put in
Thank you, yes a lot of effort & love goes into each video but it's worth it & I enjoy making them.
Before we had 'Enums', I would use an interface as you can have defined 'const' in them. It made them readable and easy to find in code. Obviously, 'Enums' are a more complete solution. Thanks for explaining. Appreciated.
Yup, enums are definitely a step up
Excellent video.
Thank you very much 💙
Thank you very much for explaining it so nicely and creativley
You're welcome 🙌
At timestamp 24:32, VS code highlights the self::Paid and others as "Undefined Class Constant". Though the app works fine though not sure why the errors?
Yea that's fine because the constants are not defined in trait they are defined in a class that uses that trait. VSCode is not a full IDE so it cant trace it back properly which is why it highlights it. PHPStorm is able to trace it and thats why it does not underline it.
@@ProgramWithGio Fantastic, I have also referred this problem to the developers of the Php Intelephense extension which i have a paid license. Lets see what we get back.
@@truthteachers Intelephense extension fixed it already
@@davidmutua6971 i am no longer using intelephense. I am using PHP Tools by Devsense
Thanks for the amazing topic 👍. Keep it coming.
More to come! Thank you
This is very good teaching
Thank you 🙌
Super high quality content as always
Thank you 🙌
Great video thanks
Glad you enjoyed it
Gio, i am puzzled with the new problem is am facing at timestamp 26:39. When i enter url as "localhost:8000/invoices" everything works fine but when i enter the url as "localhost:8000/invoices/" it goes into error page. Is there a reason for this?
By default, Nginx treats URLs with and without trailing slashes as separate locations. You would need to modify the nginx config to handle trailing slashes if you need that
@@ProgramWithGio I am using the PHP built-in server and same happens. Alternative, I resolved it coding 2 Get attributes in InvoiceController to cater for both scenarios and it works fine. Thank you so much.
@@truthteachers yup that's an option as well 👍
wow amazing🌟
Thanks
Thank you your tuto are amazing :) :)
You're welcome, thank you for support 💙
How you organize enums? We use database table for something similar, because there are more then 1000 “constants” in unique groups > group = enum.
I don’t think would be wise to create 200 files with enums.
It depends on the structure for sure, if you have that many enums then maybe a different strategy is better like storing in database. For example, you wouldnt store country codes as constants but instead store them in database
Hello, I need help,
I'm working with an Enum: Error_Code: int and trying to create an error output with another Enum_Code_De: string. I'm sure it should work, I just can't figure out how.
Maybe as a topic for another tutorial
I dont really understand the issue. I need more information & possibly actual code to be able to answer.
At this point I just like the videos before even watching them.
Thank you 🙌
You made a good job, THANKS!
Thank you 🙌
Thank you for this amazing course!
I've some questions tho. How advanced are we if made it to this video of the course? When do you think this course will be over?
I definitely would've paid to get a complete course from you, your explainations are simple and concise. Again thanks !
There are more topics I want to cover before we end the series & there is also a project towards the end. Getting through this course is good & will give you the good foundation but you need to practice & apply the knowledge by working on projects, otherwise it will fade away. That's why we'll work on a project towards the end
Gio, the Github contains the finished code for the end of the video. It is a bit difficult to copy/paste the code when I am in the middle of the video. I am all excited with the course but this is slowing down my progress.
Yes the code in branches are complete codes for the lesson. The project that we work on at the end has 2 branches for each lesson the start & the end so that way you can choose which one you want to use.
The source in the repo for these lessons are not meant to be copy/pasted, its there to see/reference the final code for the lesson. You should write the code as you are watching the video. The code is usually the same as previous lessons, so just continue from where you left off before and if a file is missing then you can check the final code for the lesson and add it in.
I know its not the most efficient way but that's the best I could do for that time. With the project its a bit easier given that it has 2 branches per lesson.
@@ProgramWithGio I understand. Just highlighting my predicament. Sorry for that.
No worries, sorry that it's creating blockers for you. It gets better in project section
THANK YOU!!!!!!!
You're welcome 🙌
Awesome!
Thank you
Thank you)
You're welcome
Amazing video as always
BTW can you make a course about Aynchronous php and ReactPHP
Would be great
Thank you. That is something I want to explore and learn myself first, so perhaps in future.
is it possible to load an enum based of its name? since enum can not be instantiated , $enum = new 'enum class name not possible'
You can do Enum::tryFrom(value) or Enum::from(value) for backed enums
thank you for the response, you did not get my point, i am trying to load enum dynamically, i have a string name of enum class ,but can not call tryfrom on string..
@@rahulchavan. yes you can if your enum is backed enum and is type string. Maybe I'm not understanding the question properly. Maybe if you share an example code I could better understand
say for example , i have ten's of enum class ,and i have fqcn of each class, i would like to load enum dynamically, if i know which enum to load i would do enum::tryfrom, but i can not do (fqcn)::tryfrom because fcqn is just a string.sorry if this is confusing or not able to make you understand.
@@rahulchavan. I think I understand, you should be able to do it by storing the enum class name in a variable & call methods on it like $enum = 'YourEnum'; and then $enum::tryfrom() that should work, have you tried it? Do you get any errors?
Is there any use case of pure enum ?? I think enum without value is pretty useless.
Yes when you don't need to save the value in database for example, something internal.
Sir, how to run Async functions and background jobs. You are doing a great job. It's great to have all required things together in a correct way. How to usewhen to use what!! Please try to cover reportinv in php also!
Thank you. We will cover background jobs like cronjobs soon in this series. What do you mean by reporting? Like reporting logs?
@@ProgramWithGio feels great to get a reply! I am more concern about the async calls, when UI gets stuck I need to implement something like async calls within Php.
I never worked on reporting part in php. Is there open source tool for database reporting like BI reports
@@AliHassan-wc6nb you could make ajax calls, depending on what you are using for your frontend. Axios is a good library for async js calls.
@@ProgramWithGio thanks for the suggestion, will check this. Thanks you, thank you so much.
@@ProgramWithGioany suggestion for implementing multi threading in php? 🤣😜🙏🏻
This lesson was:
• [E]xceptional
• [N]ice
• [U]nforgettable
• [M]agnificent
Thank you
👍
🙌
Personally i would never do color inside my backend code. Color is purely a frontend representation of data.
Totally agree, though in some cases it comes in handy. Just an example of enum
it is really eye opening and all but you're too fast. breath a little man
You can slow it down on TH-cam 👍
Enums are pretty useful. I found an interesting composer package that makes Enum cases invokable - archtechx/enums
Indeed, they are. You're welcome 🙌