There are tons of tools in IT to ease programmers' workflow and make a product more efficient. But in the very beginning of honing PHP that might be such a puzzle to pick the right direction and instruments to learn first. A common solution for such problems now – roadmaps – visual sequences which answer the question "what to learn next?". Subject I'd like to discuss in the article – where to invest your time and efforts to learn PHP faster and become an in-demand backend programmer.
To learn the programming language – just a beginning. And even here it's important to make the right steps. Don't aim to learn and memorize everything about PHP and simply focus on tools you'll be using 90% of the time. And of course, always apply gathered skills in practice.
The next deserving attention thing after learning PHP – Git. You'll probably be using it on a daily basis regardless of your chosen programming language. In a nutshell, Git is a team cooperation tool, which allows you to save states of a code.
Usage of external libraries is a great solution in most cases. Especially if they earned the community's trust. To use it efficiently you should learn the Composer – a packet manager to extremely ease the process of connecting and updating all your PHP dependencies.
And finally, we got to the databases. There are so many solutions in the market so it's even hard to list and not to forget any. However, there are few leaders of the field, which I personally recommend to pick for your stack. For relational databases it's PostgreSQL, and for NoSQL – MongoDB. PDO will be useful for understanding how all the interaction between PHP and your data happens, and ORMs – will boost the effectiveness and security of that communication.
For any programmer, speed is one of the most important factors. And debugging speed affects it directly. There are two main solutions to get rid of seeded
var_dump from a code, but my advice is to use the first and more common – xDebug. It's not ever hard to connect and configure it but it will always be bringing benefits.
But the quality of the code and its style may seem subjective things, but teamwork requires it really often. In the PSR-12 standard, you can find the list of recommendations on how to style it. That standard isn't the only existing one, but it's definitely the most common. To simplify following it you can use CodeSniffer. And in order to develop the habit of writing clean code, you can use Psalm, Phan, or PHPStan linters. There's no need to learn each – better to choose the one you like most. In my case it's Psalm.
Talking about PHP there is less and less mentioning of Full-stack. Fields of work have long been divided and PHP has taken an honorable place at the backend. Therefore learning HTML isn't a requirement for us but rather an optimization. What is really important is to clearly understand how to implement interaction with the front-end. Essential things in this area for us are REST and JSON API. Web-browser might be replaced with Postman – an ultimate tool to debug API. Earning a habit of documenting interfaces using OpenAPI or Blueprint will save you from constant questions from colleagues and give you +10 to karma.
The high response rate of the project is due not only to the servers but also to high-quality code. Sometimes to increase it, it's enough to reduce the number of requests to the database or to remember the result of heavy calculations. Caching mechanisms can help us in this. You will find interfaces for organizing them in the PSR-6 and PSR-16 standards. And choose the final caching mechanism depending on the project.
Another common method of speeding up a project is to perform processing in the background. There are two categories of solutions here: task schedulers (Crontab) will be useful for performing mailings, recalculating tariffs, and other regular tasks. And message brokers will allow you to take heavy operations into the background and monitor their execution without slowing down the response to the user.
Not all teams write tests for the code. This decision can be made on the basis of many factors. But understanding how to write the testable code is extremely important. Practicing with PHPUnit will help you gain knowledge in this area. And if you want to try other approaches, pay attention to Codeception.
When a lot of tools have been studied, it's time to combine them into a coherent system. In order not to reinvent the wheel, pay attention to one of the popular frameworks. In them, you will find the best modern practices, as well as get used to high-quality architecture. I suggest making a choice from the two most popular options:
- Symfony – strict and exacting, used mostly in highly loaded applications.
- Laravel – the most common and popular today.
When your project is launched, it is important to monitor its "health". Are the servers coping? Is there a DDoS attack? Is there a fatal exception on the prod? Monitoring is a simple and useful tool that will give you answers to all these questions. You should start with logging. The PSR-3 standard describes the interface, and Monolog will save you from having to write your own logging service. Sentry will help you to be up to date with errors, Grafana will build beautiful graphs, and Graylog or ELK will simplify log search and incident investigation.
However, there are cases that cannot be solved by simple monitoring. For example, if the application is abnormally slow in certain areas. Such incidents are most effectively solved with the help of profiling tools. You will not use them so often, but it is important to remember about their existence.
Of course, the PHP world is not limited to the listed tools and, after mastering them, there is still a lot to learn. But remember: at the beginning of your journey, you should focus on the main and most common things that you will meet in 80-90% of teams. All the listed programs and approaches were chosen according to this criterion. Save the roadmap, and check it in your educational adventure. And finally: success in studying and building a career.