Hacker News new | ask | show | jobs
by tored 2038 days ago
My recommendation is to become familiar with the package manager composer

https://getcomposer.org/

Almost all community code today is distributed with composer, anything from libraries to frameworks. Regardless if you write almost everything yourself or use a full featured framework, composer is always good to learn.

And even when you are a follower of KISS there always things that you don't care enough about to write yourself, boring things like logging frameworks (Monolog https://seldaek.github.io/monolog/) or testing frameworks (PHPUnit https://phpunit.de/). And composer can also help you set up class autoloading, a must for modern PHP.

Here you can find packages to download with composer https://packagist.org/

Next I would look into different frameworks, not necessary to use them but to learn about them and from them. The 2 biggest today is Symfony ( (https://symfony.com/) and Laravel (https://laravel.com/). But there are others like Slim (https://www.slimframework.com/), CakePHP (https://cakephp.org/), Zend (https://framework.zend.com/) and many more. Try a few and get the feeling how they do things and if you like them.

For view rendering you can do that with PHP out of the box (just remember to escape output!) or you can use a template engine like the more advanced Twig (https://twig.symfony.com/) or the simpler Mustache (https://github.com/bobthecow/mustache.php). Plates (http://platesphp.com/) uses native PHP templates but helps you create reusable layouts. Some frameworks include a template engine, e.g. Laravel uses Blade https://laravel.com/docs/8.x/blade.

For database queries I recommend reading this excellent article

https://phpdelusions.net/pdo

Many frameworks include their own query builders and sometimes a database layer (ORM).

Some semi famous people within the PHP community just released a PHP 8 book, I have not read it though.

https://front-line-php.com/

They also have free videos about PHP 8

https://spatie.be/videos/front-line-php

Ask for help https://www.reddit.com/r/PHPhelp/

Discussions about PHP https://www.reddit.com/r/PHP/

Online PHP shell https://3v4l.org/

Good luck!

1 comments

Thank you for the very in-depth reply!