Laravel: Using Unsplash API with a Service Layer and DTOs
In this tutorial, I will show you a way of architecture a Service Layer in Laravel, to interact with the Unsplash API. The Service Layer using DTOs, won’t have any concerns about validating data. Let’s see how.
What is Unsplash?
Unsplash is probably the most popular stock photography website, and it has a very big reason to be so popular.
All the photos are very good and entirely free to use, even for commercial uses.
Unsplash also has an API, unlimited, and free to use.
Websites like this one, Medium, and Trello, among others, use it to provide free quality photos for their users.
Medium, for example, allows his writers to add beautiful photos from Unsplash, in his articles, in his article editor.
Register as a developer and installing SDK
You can register as a developer here and have access to their API.
This way you will have access to an access key, which is required to programmatically interact with the API.