Drupal 8 module development
Drupal 8 module development
Learn how to write Drupal 8 modules
About the Book
Dependency injection, Namespaces, Plugins. Drupal 8 has got all of it. Fortunately, it is more developer friendly than before, but unfortunately, it raises the bar. How do you know when to create a service? How to port your module to Drupal 8? Should you write this piece of code as a plugin? Surely, you can find answers by googling. Drupal has excellent documentation. The hard part is, you will end up spending a lot of time finding out how to do things the "Drupal 8" way, and little time writing code.This book is aimed at cutting that time. Most of the content is the notes I took while porting modules to Drupal 8 and studying the code of already ported modules.
Drupal 8 is a moving target. I keep updating the book and the code as frequently as I can to keep it working with the latest release. If you find anything inconsistent, let me know and I'll update it. You have been warned, this is a WIP book.
The target audience is Drupal module developers. It should be OK even if you are entirely new to Drupal but have PHP experience.
I'd be glad if you give me any feedback, point out any mistakes etc. The fastest way to reach me is via my twitter handle(@lakshminp). I'll give due credits once the book is complete.
When is the book expected to be completed?
I plan to add new chapters in future, but a major chunk of the book will be completed by July 2017,
Is there a plan to have a print version?
None as of now. If there is a demand, I'll put up dead tree editions for sale.
Can I start using Drupal 8 now?
Damn yes. At the time I was contemplating about writing this book(July 2015), we were just 12 critical issues away from a beta release. Start learning Drupal 8 today, your future self will thank you.
Will this book help me in porting my Drupal 7 module to Drupal 8?
Sure as hell. Once you know your way around Drupal 8(which I assume this book will help you with) and have a good idea of how your module works, you're all set to port.
I'm new to Drupal development. Can I start with this book?
Yes. It should be digestible. You should know PHP and a thing or two about web frameworks though. I'd recommend Mastering Object Oriented PHP and PHP the "right" way as companion books if you are new to OO PHP and modern PHP programming practices respectively.
Hey, where is the code accompanying this book?
Its here. Feel free to fork it.
I found out a bug in your code/book.
Tweet or mail me about it, I'll get it fixed and give you due credits.
Your code is not working.
Thanks for spotting it. My apologies. I've written my code and tested it with Drupal 8 beta-6. Make sure you're running that version. The APIs keep changing. I periodically update the code to work with the latest beta release.
1. Routing and Controllers
- Your first route
- Routes with parameters
- Custom permissions
- Dynamic routes
2. Users, Authentication and Authorization
- How user authentication happens in Drupal 8
- Writing a custom authenticator
- 3. Forms
4. Services and Dependency Injection
- Understanding services
- Writing your first service
- Tagged services
- 5. Configuration Management
- What are plugins?
- How are plugins different from services
- Plugins used in core
- Plugin discovery
- Implementing a custom plugin, first cut
- Polishing the custom plugin
- 7. Fields
- Creating and loading entities
- Reading and updating entities
- Entity field query
- Entity Validation
- 9. Views
- 10. Multilingual capabilities
- 11. RESTful web services
- Drupal Console
- The Migrate module
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.