TYPO3 & the benefits of a �a resource-oriented architecture
Thomas Maroschik
CTO & shareholder at DFAU GmbH,�the creators of toujou,�the TYPO3 website builder.��@tmaroschik
Imagine sitting in a train. Replying to comments of a tweet, changing the poster image of a YouTube video, being alerted about a product running out of stock and granting your colleague permission to use iStockphoto images in his blog post.
All from within TYPO3.
“…the World Wide Web is designed to be constrained by the REST [resource-oriented] series of limitations…“ ¹
“…central feature that distinguishes the REST architectural style from other network-based styles is its emphasis on a uniform interface…“ ²
¹ https://en.wikipedia.org/wiki/Resource-oriented_architecture�² https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_5
By applying the same design to TYPO3,�users can consume and produce web resources through a unified interface.
What is the web?
When the whole world speaks a certain language�and I want to communicate efficiently,�I would be better off as a native speaker.
TYPO3 should SPEAK, LISTEN and THINK like the web, to become an interconnected content hub.
Why should we care?
“…concept of a web resource has evolved during the Web's history, from the early notion of static addressable documents or files, to a more generic and abstract definition, now encompassing every "thing" or entity…“ ¹
¹ https://en.wikipedia.org/wiki/Web_resource
By applying the same design to TYPO3,�users can consume and produce web resources through a unified interface.
Did something change? Isn’t the web document-oriented?
By using the same concepts
Resources
Verbs
Links
How can TYPO3 start to think like the web?
By applying the same constraints ¹
How can TYPO3 start to speak and listen like the web?
¹ https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1
A resource is every information�that can be named ¹
What can be a resource in TYPO3?
¹ https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_2_1_1
A resource has common properties
Type/Kind ¹
All resources of the same kind share the same characteristics.
Name/Identifier ¹
Distinguishes resources of the same kind within a namespace.
Namespace (optional)
A scope in which identifiers of resources of the same kind are unique.
What makes something a TYPO3 resource?
¹ https://jsonapi.org/format/#document-resource-object-identification
A resource provides interactions�through verbs
How could we interact with TYPO3 resources?
All verbs are individual per resource. Authors are advised to support the basic CRUD verbs.
A resource can be a subresource
What if a TYPO3 resource is not enough?
Applying the same patterns fractally
How could we apply the constraints throughout the systems?
Constraint | internally | externally |
Client - Server | e.g. Controller/Service - Repository | e.g. Browser/Service - API Endpoint |
Stateless | changes to resources are single transactions�e.g. $repo->update($object) | changes to resources are single transactions�e.g. PUT /api/page/1234 |
Cache | resources expose versions/changes or lifetimes if cacheable�e.g. by implementing different interfaces | resources expose versions/changes or lifetimes if cacheable�e.g. HTTP Cache/ETag Headers |
Layered System | require client - server role model between every layer through�hexagonal architecture that forms a self repeating pattern of the components |
The uniform interface is�a standardized way of communication ¹
What’s the uniform interface to resources?
¹ https://restapilinks.com/uniform-interface/
A resource or collection is identified by URIs ¹
How could we identify resources in TYPO3?
¹ https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#URLs_and_URNs
URI�Uniform Resource Identifier
URN�Uniform Resource�Name
URL�Uniform Resource�Locator
identifies a resource by name in a particular namespace
e.g. urn:t3:page:1234
identifies a resource by its location
�e.g. http://example.org/foo/
internally
externally
A resource may have many representations.
How could we manipulate resources in TYPO3?
internally (PHP)
externally (HTTP/gRPC/…)
Manipulation happens by interacting with the representations�via the resource provided verbs. (e.g. HTTP Methods/Class Methods/Commands)
A resource registry acts as a catalog
How could we find out about available resources and their characteristics in TYPO3?
internally (PHP)
externally (HTTP/gRPC/…)
As interfaces are externally described via OpenAPI v3, a subset of JSON Schema,�all resources are constrained to the limitations of JSON Schema.
A resource link is a reference to a resource or collection that the client can follow ¹
What role could links between TYPO3 resources play?
internally (PHP)
externally (HTTP/gRPC/…)
¹ https://en.wikipedia.org/wiki/Hyperlink
It is not guaranteed that a link can actually be successfully followed.�The target resource might be temporarily or permanently unavailable.
Intermission
Establishing the uniform interface �internally first
How do we start implement this in TYPO3?
Create building blocks that aid�in building domain specific applications
What’s next?
What do you think?
Thank you for your attention.
Discussion