How to create rest api for php site?

i created site now i want to give access to people i dont know much about api and i want to learn it so any one guide me on this. how to create json api of existing php site?

That is quite a big topic to cover.
You may get better answers by showing what you have done so far, or asking something more specific and outline your specific needs fro the API.

Though people may be able to point you to a tutorial to get you started if you don’t know where to start.

Start here: https://api-platform.com/ and then come back if you still have questions.

1 Like

First, figure out what features you want to expose to people via your API. Then pick the easiest one and code it, thinking about security, ensuring that your users can’t do anything malicious, test and test some more. Once you’ve done one, you can start to work through the rest.

1 Like

Hello, Can you please explain which kind of features you want to expose to users in API? I can give exact and better answer for a particular problem otherwise it may be a big topic will cover all API.

I used this tutorial here: http://www.tutorialsface.com/2016/02/simple-php-mysql-rest-api-sample-example-tutorial/

Then I added a Swagger interface using swagger-php (http://zircote.com/swagger-php/) This let’s your clients test your API with their own data.

Of course I already had experience writing WebAPI2 using .Net so this was fairly simple for me, including adding the SwaggerUI.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.