Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Foks's avatar
Level 15

What's optimal way of making a API in Laravel?

What's the optimal design for an API with Laravel? I know it's a pretty opinionated area of development. I currently have no clue on where / how I should start designing my own API. Any and all feedback is greatly appreciated.

Best Regards

0 likes
1 reply
martinbean's avatar

@foks A good API starts with well-defined resources. So my advice would be, really think about your models and their attributes and relations before building the API. If you start building the API before you’ve settled on your schema, that means your API is going to be constantly changing, and any integrations are going to be constantly breaking if they’re hitting endpoints that no longer exist, or trying to access attributes that no longer exist or have been renamed.

Once you’re ready to build out your API endpoints, try to stick to Laravel’s conventions:

You should then find that your API is easy to reason about and develop on. Good luck!

2 likes

Please or to participate in this conversation.