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

monstajamss's avatar

Create Json API with Auth using Laravel Sanctum

I am trying to create an API for getting all users and creating a user.

I am finding it difficult to implement this

How to use a service provider to create an interface to a 3rd party API which can be used to create and store users information that are not available locally

Thanks

0 likes
3 replies
martinbean's avatar

Does anyone have an idea?

@monstajamss There’s no need to bump your question after less than two hours.

A service provider has nothing to do with APIs. A service provider binds things to the service container.

So, if you want to create an API to retrieve and create users, do so:

php artisan make:controller "Api\UserController" --model=User
1 like

Please or to participate in this conversation.