I suddenly have an interest in picking up PHP once again, but I did not know what PHP is currently like since I last used it over a decade ago. So I asked AI some questions.
Answers I got that helped me:
1. composer is the php package manager
2. composer create project
But unluckily, the commands that AI provided really do not work in my local, I kept getting "Deprecated" in the commandline.
I used homebrew to install php, and the latest stable version is @8.XX, the I went to the composer official website, and installed composer, then by reading the docs, I installed composer successfully.
To here, I have already successfully kicked start the composer php journey.
Then "composer init", "composer require monolog/monolog".
OK, then go to src folder, "touch index.php", "echo 'hello world';".
But how to use the composer installed monolog?
The site said "require_once 'vendor/autoload.php';", then add this to index.php, then "use Monolog\Logger; $logger=new Logger('My_logger');";
Here we go, "php src/index.php",
Okay, we have successfully boosted composer managed php project!!!
Happy php!
I was wondering how laravel works, then confused why all traffic is redirected to laravel entry in "public/index.php", then thought of Nginx configuration with laravel, so, traffic configuration is done here,
, all traffic is redirected to lastly redirected to /index.php?$query_string to start laravel instance.
Timp spent: 1.5 hours in picking up PHP.