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

zaster's avatar

Rest Api - How should I proceed

I need to build a web application and a separate mobile app to access the web data.

I thought of having all my routes in the api section.

Is that the way to proceed ?

What are the factors i should consider ?

0 likes
8 replies
topvillas's avatar

If you're building an API then yeah, put all your routes in the API section.

Have you thought about whether you need to secure the API?

zaster's avatar

@topvillas Yes the API should be secured

I will have to implement an Authentication system with permissions etc...

topvillas's avatar

For authentication you have a few options.

Passport, Socialite, Sanctum or JWT. They all fill slightly different niches and you'll need to decide which would suit your needs best.

TYmon JWT package sits very nicely alongside Laravel's auth system.

topvillas's avatar

If you're making a mobile app then Sanctum isn't really an option (I should have mentioned that). It's only really of use if the api and site are on the same top level domain.

JWT looks like your best option.

topvillas's avatar

OH, well there you go! I have zero experience with mobile apps.

martinbean's avatar

@zaster If you’re building an API for a mobile app, then I’d use Passport. OAuth is a widely-supported and used spec and is technology agnostic.

Please or to participate in this conversation.