Rector - The Power of Automated Refactoring Book Released

This post was updated at June 2021 with fresh know-how.
What is new?

The book is now 100 % complete. Go get it!

In October 2020, we had a short call about Rector with Matthias Noback. He asked insightful questions to the bone of the Rector workflow, and we also had great fun chatting. Soon we started to talk more and more and decided to write a book about Rector together. With 2 points of view - the user and the maintainer.

It's been an adventurous journey for the past seven months, and today, we're proud to launch the first release of this book.

Rector book cover

<a href="" target="blank" class="btn btn-success btn-lg mt-4 mb-2">
    Buy a Copy

I thought of writing a book ever since I started blogging. I wanted to put knowledge into a concise source, where you could deep dive into one topic, have a space to think about it and reflect on it. Not just documentation and code samples, but also broader vision behind it, share challenging experiences about why do we choose A and not B and ideally, spark inspiration in the reader for their creative coding.

There was just one piece missing - the co-operation with real user, dialogue with somebody else than me. It's easy to give in to author blindness and drift away to irrelevant topics. I wanted to have a reflection, a colleague that would tell me, "I have no idea what you're trying to say here". That's what fits with Matthias.

How Pair Writing Pushes Book to Another Level?

At the start, we had a lot of discussions about how the Rector works. He gave me a lot of WTFs surprises: "Why do Rector tests load configs from the root rector.php? Why are there two forms to run a test case? How can I run Rector on PHP 7.1? Why do I need reflection to rename classes?"

Suddenly, I could see all the weak spots with developer experience. GitHub issues provide some source of poor design, but not as much as 7 months of writing a book together does. It was tremendous help for the Rector itself. We knew the Rector book would coin how you work with Rector in your project, so we worked hard to make the user experience as smooth as possible.

Along these lines, not only the Rector code improved, but the book also got its storyline - about how Rector was inevitable and only possible thanks to the work of dozens of PHP developers across a life span of 20 years... pst, not to spoil.

Who is the Book For?

Do you Rector daily, write your own custom Rector rules, and have tests for them? Have you migrated 3 legacy projects with Rector and use Rector in CI to work for you? Don't read it, it would not teach you any new technical skill (Sebastian! :)). On the other hand, the book goes beyond technical steps and shows a future vision for the PHP community, where Rector is just one of the building stones.

Do you use Rector in CI on your new projects and find it easy? Yet, do you struggle with your legacy project and don't believe Rector can help you? Are you lost in the terminology of AST, nodes, and traversing?

Read this book. It will take you step by step, explain pitfalls you struggle with, and give you the confidence to migrate any legacy project with automated refactoring.

Would you like to get a job faster than your peers? Do you see yourself as an innovative person? Do you lack time to do changes you see as positive? Would you love to automated your code reviews and get more time for human interactions? Do you dream of a world without legacy code?

Read this book. It will give you a broad picture of the PHP toolchain, the knowledge framework of using them together, and the power to make automated refactoring your daily bread with Rector. Who knows, maybe your next project will run Rector beneath and turn into disruptive innovation.

Support Rector Development

By buying this book, you also support the Rector ecosystem and help developers around to improve it.

Happy coding!

Do you learn from my contents or use open-souce packages like Rector every day?
Consider supporting it on GitHub Sponsors. I'd really appreciate it!