Don't ever deal with POST, GET or REQUEST, use a library for that. Search for PSR-7 and PSR-17.
Use the PSR implementation to manipulate headers (redirection, content type), cookies and body of the request.
Do not echo anything, again, use templates to generate HTML content (Plates, Twig or Latte). Use serializers to generate JSON.
Do not require scripts, write OOP code and use Composer with autoloading.
Only ever use prepared statements with PDO or use a library for that (like DBAL, dibi) or an ORM.
Use a micro framework if you want to keep it tiny (like Slim) or a do yourself a favor and study a full framework like Symfony or Laravel for any HTTP request handling. Use something like Symfony Console for CLI tasks.
And learn to write tests right at the beginning, it will improve your coding skill greatly.
Well... Let me give you a give you a guidance.
Don't ever deal with POST, GET or REQUEST, use a library for that. Search for PSR-7 and PSR-17.
Use the PSR implementation to manipulate headers (redirection, content type), cookies and body of the request.
Do not
echo
anything, again, use templates to generate HTML content (Plates, Twig or Latte). Use serializers to generate JSON.Do not
require
scripts, write OOP code and use Composer with autoloading.Only ever use prepared statements with PDO or use a library for that (like DBAL, dibi) or an ORM.
Use a micro framework if you want to keep it tiny (like Slim) or a do yourself a favor and study a full framework like Symfony or Laravel for any HTTP request handling. Use something like Symfony Console for CLI tasks.
And learn to write tests right at the beginning, it will improve your coding skill greatly.
Sorry for preaching. Bare with me. 🐻
Thank you Andrej, I also agree with those points 👍🏻
You are welcome. I wish somebody told me that when I was beginning 😆
But there was no PSR back then IIRC. 🤔😁