Top 10 Books For PHP Developers
These books will help you learn more about PHP in detail and make you a better software engineer overall.
When I started my career in the web development world, I was mostly learning from video courses because that was my preferred way of learning as self-taught developer (even though I finished college back in 2012).
I was never really a book reader until later in my career, even though I spent a few years on the Laracasts forums helping people and learning from discussions.
These days, I learn from different learning resources but if I were to start learning modern PHP today, I would definitely start reading more books, because they do have a lot more detailed content and theory rather than the video courses.
Video courses are amazing for learning the tools and the language in general, by building projects, getting the hang of things, but books that really changed my way I think about building products these days.
It doesn't matter if you use Laravel, Symfony, Laminas, Spiral, (Open) Swoole, Hyperf, X or any other PHP framework.
If were to start from scratch today, I would read these books in this order and experiment on my own projects to get a better understanding of the concepts explained in them.
This book will get you up to speed with the basics of PHP and give you a few small projects to build in your learning journey.
This book will get you up to speed with the latest additions to PHP up to (the upcoming release of) 8.2 so that you can familiarize yourself what's possible to do with the modern PHP features that has been added in the most recent years.
This book will teach you everything about object oriented programming and the different types of objects in PHP.
This book will teach you about applying the SOLID principles in PHP among other things.
This book will teach you about some of the tactical patterns of Domain Driven Design and Hexagonal Architecture, which also has a full application built in PHP for you to check out.
I finished reading this book and I must say that it’s a great book with a lot of interesting ideas on how to manage your code for long-term projects by decoupling from the framework.
Highly recommended for people battling bugs.
When you read all of the content, you might think it’s an overkill, but you don’t really have a choice because as the project grows, you don’t want to lose morale and momentum, lose the bugs battle and slow down the implementation of new features.
I’ve said previously that working on big distributed systems is a completely different world, once you implement a feature, it gets harder to change later on due to the effort and time it requires for it to get implemented and tested.
I loved the examples in the book, all of it made sense, there’s even a whole application on GitHub to get the whole picture. The testing chapter gave me a different view and understanding about testing compared to what I’ve known and done so far in my client projects.
The ideas in the book are not exactly for people who are working alone on their own projects because they won’t see the benefits right away compared to a project that is being built faster in a team of multiple people but they are worth checking out just in case they need them.
If you try to apply all of these ideas at once with all of the rules and tools mentioned, you would most likely give up and probably want to go to live on a farm somewhere and I’ve thought of doing that sometimes, because the more I learn, the less I know and it scares me.
I still don’t think that people want to write code like this just for the sake of it but the main goal is to have a better chance of fighting against bugs and business requirements in the long term, along with saving a ton of money for the business.
This book will teach you about some of the tactical patterns of Domain Driven Design and Hexagonal Architecture, from a different point of view compared to the previous book. This book also has a full PHP app example.
I highly recommend the DDD in PHP book first because it has some great ideas and examples about how to think, code and design complex long term apps.
DDD might be overkill for the apps that are not as complex or when you are working alone on a CRUD based app trying to implement everything quickly just so that you are done as soon as possible but they are just ideas which can help you in some cases if you ever get there.
The good thing about the book is that it provides the pros and cons of each architecture and approach.
This book will teach you about Command-Query Responsibility Segregation and how to think about it and use it in PHP. This book also has a full app example for reference.
I highly recommend it, especially if you want to or work on a distributed system. I loved it because of how detailed the examples are and how they think in terms of designing the code first.
It also has some ideas about how to think and approach the design of the features.
This book will teach you about decoupling your business logic / domain code from the framework of choice, and how to create PHPStan rules to stop others from misusing the rules of writing code.
This book will teach you everything you need to know about how to automatically refactor and upgrade your PHP code with Rector.
This book will teach you about Microservices, pros and cons of using them and how to implement them in PHP. This book has a great Microservices example for reference.
This book will teach you about the functional programming concepts and how you can apply them while working with PHP.
This book will teach you everything you need to know about using PostgreSQL
Bonus 3: Mastering Swoole by Bruce Dou
This book will teach you about (Open) Swoole, as well as some of the async programming concepts and how you can apply them when working with PHP.
This book contains a lot of examples that you can use to learn MySQL, from writing different types of queries to manage and administer the database.
Bonus 5: Efficient MySQL Performance by Daniel Nichter
Bonus 6: MySQL 8 Query Performance Tuning by Jesper Wisborg Krogh
Bonus 7: MySQL Concurrency by Jesper Wisborg Krogh
Bonus 8: High Performance MySQL by Silvia Botros, Jeremy Tinley
These 4 books will give you more details and ideas how to optimize the database and write performant queries in general.
This will book will teach you everything you need to know about testing and how to write different types of tests.
This book will teach you about implementing REST APIs, HATEOS, caching, content negotiation, versioning, URI formatting, authentication and more.
This is a book about SQL Patterns. Patterns describe problems that occur over and over in our professional settings.
Tobias has been posting tips on Twitter for a year so he compiled all of his tips in this free ebook. It will help you and give you some additional ideas, tips and tricks about how to write specific queries for specific problems.
I read some of these and I do have some others that are ready to be read soon as well but the ones that I read already changed the mindset of how I approach and build apps. Some of these books may be a little bit advanced for you but they are worth reading if you ask me.
The PHP related books mostly contain native PHP code but some of them might use Laravel or Symfony as a framework in order to show the examples easily.
Don't worry about some of the code being outdated in some of the older books, the ideas are still relevant today.
These books also contain other book recommendations in them so you will have endless books to read after you are done with these. If you have any other books to recommend, feel free to mention them by replying to this tweet.
Matthias Noback created a list of books with 20% discount, so if the links in this blog post do not have a discount, use his links if you want to buy any of his books.