PHP CLI Development Intro - #89
1 minutes
32:19 minutes
If you are not familiar with CLI, then this is the perfect introduction for you. In this tutorial, I will go over how to write command-line-driven PHP where you can hit an external API and parse results by simply typing a single command in your terminal. With CLI, you can give other non-developers a way to run your code with flags and variables that will be contained within 1 line in either CMD, Powershell, Terminal, or other command-line interfaces.
This tutorial is not in-depth by any means but should help you get started with exploring CLI and PHP development.
Code we will run in CLI:
php index.php {postID or NULL} {-c or NULL} {true or null|false}
00:00 Intro
00:45 What is CLI?
01:48 Setting Up Our Autoloader
06:45 Creating Our Data Class
13:53 Setting Up Arguments in CLI
16:35 Dumping Our Arguments
20:26 Hitting Our API
26:24 Dumping the API Data
Download tutorial files here: https://github.com/thedevdrawer/cli
⭐ If you would like to buy me a coffee because I created something that helped you, it would be much appreciated! : https://www.buymeacoffee.com/devdrawer
⭐ Join this channel to get access to perks:
https://www.youtube.com/channel/UCcr8eSk5xCfn3AbYy8WOWzg/join
⭐ Become a Patreon to show support and get exclusive access to content: https://www.patreon.com/devdrawer
Like what you see, support the channel.
Get Merch Buy Me A Coffee Join Patreon Watch on YouTube View Projects on GitHub