Video Lesson: What are service contracts in Magento?

What are service contracts in Magento?

This is premium content

Only available to enrolled or University students.
Join today to unlock all lessons in this course.

What are service contracts in Magento?

Magento service contracts are PHP interfaces that define stable APIs for modules and web services.

Lesson Content

Magento has the idea of what is known as “service contracts”. But what are they?

Simple: they are just a set of PHP interfaces!

Recapping what an interface is: it’s just a blueprint for a class to follow. For example, given this interface named Blueprint:

<?php

interface Blueprint {
    public function implementThis(): string;
    public function implementThat(): string;
}

All this interface means is that when a class implements it, it must implement all of the functions of this interface. Note also how the interface functions don’t contain implementations. The...

Premium content

Enroll to unlock the full content and all course materials.

Maggie

Hey, I'm Maggie! 👋

Ask me anything.

Want to chat with Maggie?

Enroll in this course for AI tutor access.

Comments

Join the discussion!

Comments

Want to comment on this lesson?

Enroll in this course to leave comments.