One Shoe logo
Overview

Laravel & Prismic.io: a new technical approach for an API driven experience

For more than a decade we have built digital experiences for our clients with content management systems (CMS’s) like Drupal and Wordpress. During our work ofStudiekeuze123.nlhowever, the focus was on creating a fully API driven digital experience. When we started this exciting new project, we realized that we had to rethink our standard approach. We integrated Laravel and Prismic.io.

One Shoe | 23 aug 2018

The project: Studiekeuze123.nl
Studiekeuze123 lists all the education programs in the Netherlands to help students make informed life choices. Their website Studiekeuze123.nl gives (aspirant) students a complete overview of all available studies in the Netherlands and information about the universities. In other words: Studiekeuze123.nl creates easy access to search, find and compare studies for students to find the right one.

They asked us to renew their platform. And because the focus of this project was on creating a fully API driven experience, we had to combine the content management part and application logic within one unified API. The integration of Laravel and Prismic.io enabled us to create a light and solid solution.

Laravel — for fully API driven projects
For building API’s we already use Laravel as our main platform of choice. Possible cases for these kinds of projects are ecommerce driven experiences, service backends for mobile and headless apps.

With Laravel we are able to create these applications in a well- structured manner and still achieve fast development cycles for our clients. In this specific case this was exactly what was needed.

Prismic.io — a cloud-based CMS
During the discovery phase we learned that besides primary content (which is consumed via an external API), that there was still some sort of secondary content needed. In our opinion it’s a good practice to separate this kind of secondary content from primary content and business logic. To make this work we decided to use Prismic.io, a cloud-based CMS, which can be described as a “CMS as a service”.

Using Prismic.io is not free of charge. However, the benefits of Prismic.io are well worth the monthly fee. The ease of configuration, the API first architecture, a powerful editor UI, a no-hosting- setup and no maintenance characteristics are just a few reasons why Prismic.io is a good idea to use.

Prismic.io offers content modelling strategies for both structured content and non- structured content. We’ve discovered that one of the best features of Prismic.io is the ability to build dynamic layouts with content slices. This allows content managers to construct pages that contains different page elements. This is extremely useful for the secondary content that was needed on pages like “About Us” or Landing pages used for digital marketing.

Combining Laravel & Prismic.io
In the end, we’ve combined these technologies in a way that Laravel consumes the Prismic.io API’s and will generate the needed pages which are navigable through the available routes. An example can be found here. As you can see the page has been build up from different content parts. Within Prismic.io, content managers use slices to create these kinds of pages and during the creation, the content managers have total freedom in how they construct these pages.

We created a comfortable way to integrate Prismic.io with Laravel
There are several ways to integrate Prismic.io with Laravel. But during our search for the optimal approach, our Lead Laravel Developer, Robin Drost, discovered that a Laravel Eloquent integration is one of the most comfortable ways to integrate Laravel and Prismic.io. That’s why Robin created a Laravel package which provides functionality that allows you to interact in an eloquent way with the Prismic.io API. 

Thanks to this Prismic-eloquent Laravel package, Laravel developers now have a familiar way of integration.

· The Prismic-eloquent Laravel package is open source, and available on GitHub: https://github.com/robindrost/prismic-eloquent

· Documentation can be found here: https://prismic-eloquent.gitbook.io/docs/

· An example of a project is available here:https://github.com/robindrost/prismic-eloquent-blog

Want to know more?
Interested in our Prismic-eloquent Laravel approach and want to find out how this can help you(r business)? Give us a call or send us an email. We are here to help!

About the author
Floris Derksen is Director of Experience Design and co-founder of One Shoe. At One Shoe he leads the cross functional team of Strategists, UX designers, Visual designers and Front-end Developers that works for clients such as DHL, LeasePlan and Sanofi.

About One Shoe
One Shoe is an international creative & digital agency. Our services are a blend of thinking, creating and crafting: we combine brand strategy with digital strategy, UX, design and development. With more than 45 specialists, we create campaigns and digital solutions that engage people, encourage action and propel growth. Clients are DHL, Yakult, Total, Sanofi Genzyme, Eurail, St. Antonius Hospital and many others.

About Studiekeuze123
Studiekeuze123 is a foundation set up by students, higher education and the Dutch Ministry of Education, Culture and Science to collect and disseminate objective study choice information.